Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: chokun
Problemset: อะนาแกรม 2
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-13 08:03:58
#include <bits/stdc++.h>
using namespace std;
int main(){
string s1, s2;
cin >> s1 >> s2;
vector<int> count1(8, 0);
for (char c : s1){
int index = c - 'A';
count1[index]++;
}
for (int i = 0; i < 8; i++){
cout << count1[i] << (i == 7 ? "" : " ");
}
cout << endl;
vector<int> count2(8, 0);
for (char c : s2){
int index = c - 'A';
count2[index]++;
}
for (int i = 0; i < 8; i++){
cout << count2[i] << (i == 7 ? "" : " ");
}
cout << endl;
int sum = 0;
for (int i = 0; i < 8; i++){
cout << abs(count1[i] - count2[i]) << (i == 7 ? "" : " ");
sum += abs(count1[i] - count2[i]);
}
cout << endl;
if(sum <= 3){
cout << "anagram";
}else{
cout << "no";
}
}