Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Kei
Problemset: อะนาแกรม 2
Language: cpp
Time: 0.005 second
Submitted On: 2026-10-08 14:10:18
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
void solve(){
string s1,s2;
cin >> s1 >> s2;
int a[8] = {}, b[8] = {}; int k=0;
vector<int> d(8);
for(char c : s1) a[c - 'A']++;
for(char c : s2) b[c - 'A']++;
for(int i=0;i<8;i++){
d[i] = abs(a[i]-b[i]);
k+=d[i];
}
for(int& x : a) cout << x << ' ';
cout<<'\n';
for(int& x : b) cout << x << ' ';
cout<<'\n';
for(int& x : d) cout << x << ' ';
cout<<'\n';
if(k<=3){
cout << "anagram";
}
else cout << "no";
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}