1 #include<iostream> 2 #include<string> 3 #include<stdio.h> 4 #include<algorithm> 5 #define MAXN 105 6 using namespace std; 7 int c[2][26]; 8 int main() 9 { 10 ///freopen("acm.acm","r",stdin); 11 int i; 12 int len_0; 13 int len_1; 14 string s1; 15 string s2; 16 cin>>s1>>s2; 17 len_0 = s1.length(); 18 len_1 = s2.length(); 19 if(len_0 != len_1) 20 { 21 cout<<"NO"<<endl; 22 return 0; 23 } 24 for(i = 0; i < len_0; ++ i) 25 { 26 ++ c[0][s1[i] - 'A']; 27 ++ c[1][s2[i] - 'A']; 28 } 29 sort(c[0],c[0]+26); 30 sort(c[1],c[1]+26); 31 for(i = 0; i < 26; ++ i) 32 { 33 if(c[0][i] != c[1][i]) 34 { 35 cout<<"NO"<<endl; 36 return 0; 37 } 38 } 39 cout<<"YES"<<endl; 40 } 41 42 /* 43 if(equal(c[0],c[0]+strlen(c[0]),c[1])) 44 cout<<"YES"<<endl; 45 else 46 cout<<"NO"<<endl; 47 48 */
关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。
技术网站地址: vmfor.com