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 |
两个统计次数的数组#include<iostream> #include<algorithm> using namespace std; char t1[26], t2[26], s[101]; int main(void) { cin >> s; for (int i = 0; s[i]; i++) t1[s[i] - 'A']++; cin >> s; for (int i = 0; s[i]; i++) t2[s[i] - 'A']++; sort(t1, t1 + 26); sort(t2, t2 + 26); for (int i = 0; i < 26; i++) { if (t1[i] != t2[i]) { cout << "NO\n"; return 0; } } cout << "YES\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