HDU 1219 AC Me
strlen能不用就不用
#include<cstdio> #include<cstdlib> #include<iostream> #include<algorithm> #include<memory.h> #include<cmath> #include<cstring> #include<string> using namespace std; char s[100010]; int a[30]; int main() { int i,L; while(gets(s)){ memset(a,0,sizeof(a)); L=strlen(s); for(i=0;i<L;i++){ int tmp=s[i]-'a'+1; if(tmp>=1&&tmp<=26) a[tmp]++; } for(i=1;i<=26;i++) printf("%c:%d\n",(i+'a'-1),a[i]); printf("\n"); } return 0; }
It is your time to fight!