Submission
Status:
----------
Subtask/Task Score:
0/100
Score: 0
User: Design
Problemset: อะนาแกรม 2
Language: cpp
Time: 0.005 second
Submitted On: 2026-09-30 18:53:23
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
using namespace std;
int main()
{
string S;
string X;
cin>>S;
cin>>X;
int box[125]={};
int abox[125]={};
int n=S.length();
int Y=X.length();
int A;
int Z;
int count;
for (int i=0 ; i<8; i++){
//cout<<S[i]<<int(S[i])<<endl;
A=(int(S[i]))-65;
box[A]+=1;
}
for (int i=0 ; i<8; i++){
cout<<box[i]<<" ";
}
cout<<'\n';
//---------------------------------------------------------------------------------------------------------------------------
for (int i=0 ; i<8; i++){
//cout<<S[i]<<int(S[i])<<endl;
Z=(int(X[i]))-65;
abox[Z]+=1;
}
for (int i=0 ; i<8; i++){
cout<<abox[i]<<" ";
}
cout<<'\n';
//----------------------------------------------------------------------------------------------------------------------------
for (int i=0 ; i<8; i++){
if (box[i]==abox[i]){
cout<<"0 ";
}
else {
cout<<abs(box[i]-abox[i])<<" ";
count++;
}
}
cout<<'\n';
if (count>=3){
cout<<"no";
}
else{
cout<<"anagram";
}
return 0;
}