-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path10062.cpp
More file actions
52 lines (48 loc) · 666 Bytes
/
10062.cpp
File metadata and controls
52 lines (48 loc) · 666 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* USER: 93043 (mkbs_cse09) */
/* PROBLEM: 1003 (10062 - Tell me the frequencies!) */
/* SUBMISSION: 09597165 */
/* SUBMISSION TIME: 2011-12-28 04:07:03 */
/* LANGUAGE: 1 */
#include<stdio.h>
#include<string.h>
long a[150];
int main()
{
long i,j,max,l,flag=0;
char ch[1005];
while(gets(ch))
{
for(i=32;i<=127;i++)
{
a[i]=0;
}
l=strlen(ch);
max=0;
for(i=0;i<l;i++)
{
a[ch[i]]++;
if(a[ch[i]]>max)
{
max=a[ch[i]];
}
}
j=1;
if(flag==1)
printf("\n");
flag=1;
while(j!=(max+1))
{
i=127;
while(i!=31)
{
if(a[i]==j)
{
printf("%ld %ld\n",i,a[i]);
}
i--;
}
j++;
}
}
return 0;
}