-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanton.java
More file actions
30 lines (27 loc) · 825 Bytes
/
anton.java
File metadata and controls
30 lines (27 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.util.*;
public class anton {
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int count=0,mount=0,z=0;
int a=sc.nextInt();
String input = sc.next(); // Read entire string without spaces
for(int i=0;i<a;i++){
char ch = input.charAt(i); // Get character at position i
if(ch=='A'){
count++;
}else if(ch=='D'){
mount++;
}else{
z++;
}
}
if(count>mount){
System.out.println("Anton");
}else if(count==mount){
System.out.println("Friendship");
}else{
System.out.println("Danik");
}
sc.close();
}
}