Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么WA?int main(){ string s1,s2; int i,j; while(cin>>s1>>s2){ int letter1[26]; int letter2[26]; memset (letter1,0,sizeof(letter1)); memset (letter2,0,sizeof(letter2)); int len1=s1.length(),len2=s2.length(); if(len1!=len2) printf("NO\n"); else{ for(i=0;i<len1;i++){ letter1[s1[i]-'A']++; letter2[s1[i]-'A']++; } } len1=0; len2=0; for(i=0;i<26;i++){ if(letter1[i]){ len1++; for(j=0;j<26;j++){ if(letter1[i]==letter2[j]){len2++;letter2[j]=0;break;} } } } if(len1==len2) printf("YES\n"); else printf("NO\n"); return 0; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator