Submission
Status:
P--PPPP--P
Subtask/Task Score:
60/100
Score: 60
User: sakuragichan
Problemset: อะนาแกรม 2
Language: cpp
Time: 0.002 second
Submitted On: 2026-09-08 15:49:40
#include <bits/stdc++.h>
using namespace std;
int main() {
string s ,c;
vector<int> num1 ,num2;
cin >> s >> c;
char a[8] = {'A','B','C','D','E','F','G','H'};
for (char x : a) {
int d = count(s.begin(), s.end(), x);
cout << d << " ";
num1.push_back(d);
}
cout << endl;
int j = 0;
for (char x : a) {
int d = count(c.begin(), c.end(), x);
cout << d << " ";
num2.push_back(d);
}
cout << endl;
for (int i= 0 ; i< 8; ++i) {
if (abs(num1[i]-num2[i]) >0) {
cout << abs(num1[i] - num2[i]) << " ";
j += abs(num1[i]-num2[i]);
}
else {
cout << 0 << " ";
}
}
cout << endl;
if (j>3){
cout<< "NO";
}
else {
cout << "anagram";
}
}