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 |
300题留念,1A,留下源码#include <cstdio> #include <cstring> #include <algorithm> using namespace std; char C[101]; char M[101]; int Ctr1[27]; int Ctr2[27]; int main(){ scanf("%s %s", C, M); int L = strlen(C); memset(Ctr1, 0, sizeof(Ctr1)); memset(Ctr2, 0, sizeof(Ctr2)); for (int i = 0; i < L; ++i) { Ctr1[C[i] - 'A'] ++; Ctr2[M[i] - 'A'] ++; } sort(Ctr1, Ctr1 + 27); sort(Ctr2, Ctr2 + 27); bool flag = true; for (int i = 0; i < 27; ++i) { if (Ctr1[i] != Ctr2[i]){ flag = false; break; } } if (flag){ printf("YES\n"); } else{ printf("NO\n"); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator