-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2138.c
76 lines (59 loc) · 916 Bytes
/
2138.c
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include<stdio.h>
#include<string.h>
int res (char a);
int main() {
char ch[1002];
int ar[10]={0},a,i,c,m;
while(scanf("%s",&ch)!=EOF){
a = strlen(ch);
for (i=0;i<a;i++){
c = res(ch[i]);
ar[c] = ar[c]+1;
}
c = 0;
for (i=0;i<=9;i++){
if ( ar[i] >= c){
c = ar[i];
m = i;
}
ar[i] = 0;
}
printf("%d\n",m);
i = 0,c =0,m=0;
a = 0;
}
return 0;
}
int res (char a){
if(a=='0'){
return 0;
}
else if(a=='1'){
return 1;
}
else if(a=='2'){
return 2;
}
else if(a=='3'){
return 3;
}
else if(a=='4'){
return 4;
}
else if(a=='5'){
return 5;
}
else if(a=='6'){
return 6;
}
else if(a=='7'){
return 7;
}
else if(a=='8'){
return 8;
}
else if(a=='9'){
return 9;
}
return -1;
}