-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathptice.java
41 lines (27 loc) · 1.18 KB
/
ptice.java
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
31
32
33
34
35
36
37
38
39
40
41
import java.util.Scanner;
public class ptice {
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int slen = scan.nextInt();
String answers = scan.next();
int a=0;
int b=0;
int c=0;
String as = "ABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABC";
String bs = "BABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABC";
String cs = "CCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABB";
for(int i=0; i < slen; i++)
{
if(answers.charAt(i) == as.charAt(i)) a++;
if(answers.charAt(i) == bs.charAt(i)) b++;
if(answers.charAt(i) == cs.charAt(i)) c++;
}
int max = Math.max(a, Math.max(b, c));
System.out.println(max);
if(a == max) System.out.println("Adrian");
if(b == max) System.out.println("Bruno");
if(c == max) System.out.println("Goram");
scan.close();
}
}