-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNo_1157.java
More file actions
44 lines (37 loc) · 1.12 KB
/
No_1157.java
File metadata and controls
44 lines (37 loc) · 1.12 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
/*
Problem_1157_단어 공부
https://www.acmicpc.net/problem/1157
*/
import java.io.*;
import java.util.StringTokenizer;
public class No_1157 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String output = output = br.readLine();
int count[] = new int[26];
br.close();
for (int j = 0; j < output.length(); j++) {
if ( (65 <= output.charAt(j)) && (output.charAt(j) <= 90)) {//대문자 -> 소문자
count[output.charAt(j) - 65]++;
}
else {
count[output.charAt(j) - 97]++;
}
}
int M = -1;
char ch = '?';
for (int k = 0; k < 26; k++) {
if (M < count[k]) {
M = count[k];
ch = (char)(k + 65);
}
else if (M == count[k]) {
ch = '?';
}
}
bw.write(ch);
bw.flush();
bw.close();
}
}