Submission
Status:
PPPPPPPP-P
Subtask/Task Score:
90/100
Score: 90
User: Fadil
Problemset: อะนาแกรม 2
Language: cpp
Time: 0.003 second
Submitted On: 2026-10-05 09:46:06
#include<bits/stdc++.h>
using namespace std;
int main(){
map<char,int> m1;
map<char,int> m2;
for(char i = 'A';i <= 'H';i++){
m1[i] = 0;
m2[i] = 0;
}string s1,s2;
cin >> s1 >> s2;
for(char x:s1){
m1[x]++;
}for(char x:s2){
m2[x]++;
}
for(auto x:m1){
cout << x.second << " ";
}cout << "\n";
for(auto x:m2){
cout << x.second << " ";
}cout << "\n";
int cnt = 0;
for(char i = 'A';i<='H';i++){
if(m1[i] != m2[i]){
cout << 1 << " ";
cnt++;
}else{
cout << 0 << " ";
}
}cout << "\n";
if(cnt <= 3){
cout << "anagram";
}else{
cout << "no";
}
}