hdu 1219(字符串处理)

//简单字符串处理
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

char text[100005];
int s[26];

int main() {
while (gets(text)) {
int l = strlen(text);
int i;
for (i=0; i<26; ++i) s[i] = 0;
for (i=0; i<l; ++i) ++s[text[i]-'a'];
for (i=0; i<26; ++i) printf ("%c:%d\n", i+'a', s[i]);
puts("");
}
return 0;
}

 

你可能感兴趣的:(字符串处理)