Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: pann
Problemset: อะนาแกรม 2
Language: cpp
Time: 0.003 second
Submitted On: 2026-10-04 21:20:02
#include <iostream>
using namespace std;
int main(){
string s1, s2;
cin >> s1 >> s2;
int c1[8] = {}, c2[8] = {}, c3[8] = {};
for (int i = 0; i < s1.length(); i++){
c1[s1[i] - 'A']++;
}
for (int i = 0; i < s2.length(); i++){
c2[s2[i] - 'A']++;
}
for (int x: c1){
cout << x << " ";
}
cout << "\n";
for (int i = 0; i < 8; i++){
cout << c2[i] << " ";
c3[i] = c1[i] - c2[i];
}
cout << "\n";
int count = 0;
for (int x: c3){
if (x < 0){
cout << -x << " ";
}
else {
cout << x << " ";
}
if (x != 0){
count++;
}
}
if (count > 3){
cout << "\nno";
}
else {
cout << "\nanagram";
}
return 0;
}