文章
12
粉丝
693
获赞
3
访问
126.4k
#include <stdio.h>
#include <string.h>
#include <bits/stdc++.h>
using namespace std;
int main() {
char str[1010];
while(gets(str)){
int hash[256] = {0};
int max;
int length = strlen(str);
int count = 0, kong = 0;
for(int i = 0; i < length; ++i) {
if(str[i] >= 'a' && str[i] <= 'z') {
count++;
hash[str[i]]++;
}
else if(str[i] >= 'A' && str[i] <= 'Z') {
count++;
hash[str[i]]++;
}
else kong++;
if(hash[str[i]] >= max) max = hash[str[i]];
}
printf("%d\n%d\n", count, kong + 1);
for(int i = 0; i < length; ++i) {
if(hash[str[i]] == max) {
printf("%c ", str[i]);
hash[str[i]] = 0;
}
}
printf("\n%d\n", max);
}
return 0;
}
/*
This is An Pencil Case
18
5
i s
3
Hello World
10
2
l
3
Hello leeoo
10
2
e l o
3
登录后发布评论
换行变成\r\n了,可以了