A — Anton and Danik D2

Revision en1, by AyaAbdelmoghith, 2019-06-24 00:56:53

[ This is my code, I check it on Eclipse (The program I use to code) it works. However, I submitted here it doesn't work.][Here is the problem question](http://codeforces.com/contest/677/problem/A) ~~~~~ import java.util.Scanner;

public class AntonandDanik {

public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    Scanner string = new Scanner(System.in);
    int noGames= input.nextInt();
    String name = string.nextLine();//name.length()
    name=name.toUpperCase();
    int countA=0;
    int countD=0;
    char winner;
    for (int i=0; i<noGames;i++){
       winner= name.charAt(i);
       if (winner == 'A')
         countA++;
       else if (winner == 'D')
         countD++;
    }

    if (countA > countD)
       System.out.println("Anton");
    else if (countA < countD)
       System.out.println("Danik");
    else if (countA == countD)
       System.out.println("FriendShip");


}

} ~~~~~

Tags #implementation, #strings, #java8

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English AyaAbdelmoghith 2019-06-24 00:56:53 941 Java (published)