Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Folk_DIWA
Problemset: อะนาแกรม 2
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-13 01:10:15
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
cin.tie(0)->sync_with_stdio(0);
string a,b; cin >> a >> b;
map <char, int> freq_a = {
{'A',0},{'B',0},{'C',0},{'D',0},
{'E',0},{'F',0},{'G',0},{'H',0}
};
map <char, int> freq_b = {
{'A',0},{'B',0},{'C',0},{'D',0},
{'E',0},{'F',0},{'G',0},{'H',0}
};
for(auto &c : a) freq_a[c]++;
for(auto &c : b) freq_b[c]++;
vector <int> va,vb,diff;
for(auto &[key,val] : freq_a) va.push_back(val);
for(auto &[key,val] : freq_b) vb.push_back(val);
for(int i=0; i<va.size(); i++){
diff.push_back(abs(va[i] - vb[i]));
}
for(auto &x : va) cout << x << ' '; cout << '\n';
for(auto &x : vb) cout << x << ' '; cout << '\n';
for(auto &x : diff) cout << x << ' '; cout << '\n';
int cnt = 0;
for(int i=0; i<diff.size(); i++){
if(diff[i]) cnt++;
}
if(cnt <= 3) cout << "anagram" ;
else cout << "no";
return 0;
}