-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBAEKJOON_1157
More file actions
46 lines (31 loc) · 1.11 KB
/
BAEKJOON_1157
File metadata and controls
46 lines (31 loc) · 1.11 KB
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
42
43
44
45
46
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringBuilder sb =new StringBuilder(br.readLine());
int[] arr= new int[26]; //영문자 개수
String word = sb.toString();
for(int i=0; i<word.length(); i++){
if(word.charAt(i) >=65 && word.charAt(i) <=90){
arr[word.charAt(i)-65]++;
}else{
//소문자 부분이므로
arr[word.charAt(i)-97]++;
}
}
int max = -1;
char ch = '?';
for(int i=0; i<26; i++){
if(arr[i] >max){
max = arr[i];
ch = (char)(i+65);
}else if(arr[i] == max){
ch = '?';
}
}
System.out.println(ch);
}
}