Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: sulinx
Problemset: อะนาแกรม 2
Language: cpp
Time: 0.003 second
Submitted On: 2025-11-10 22:10:28
#include <bits/stdc++.h>
using namespace std;
int main(){
int count1[8] = {0};
int count2[8] = {0};
int sum = 0;
string str;
cin >> str;
for(int i = 0;i<str.length();i++){
count1[str[i]-65]++;
}
cin >> str;
for(int i = 0;i<str.length();i++){
count2[str[i]-65]++;
}
for(int i = 0;i<8;i++){
cout << count1[i] << " ";
}cout << '\n';
for(int i = 0;i<8;i++){
cout << count2[i] << " ";
}cout << '\n';
for(int i = 0;i<8;i++){
count1[i] = abs(count1[i] - count2[i]);
cout << count1[i] << " ";
sum+=count1[i];
}cout << '\n';
if(sum>3){
cout << "no";
}else{
cout << "anagram";
}
}