-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathI042.java
More file actions
28 lines (23 loc) · 737 Bytes
/
I042.java
File metadata and controls
28 lines (23 loc) · 737 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
package levelB;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class I042 {
public static void main(String[] args) throws Exception{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str=br.readLine();
char[] c=str.toLowerCase().toCharArray();
int count[]=new int[26];
for(int i=0;i<c.length;i++){
if(c[i]>='a'&&c[i]<='z')
count[c[i]-97]++;
}
int max=0,index=0;
for(int i=0;i<26;i++){
if(count[i]>max){
max=count[i];
index=i;
}
}
System.out.print((char)(index+97)+" "+max);
}
}