Submission
Status:
P--PPPP--P
Subtask/Task Score:
60/100
Score: 60
User: cheraim
Problemset: อะนาแกรม 2
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-09 08:20:38
#include <iostream>
using namespace std;
#include <cmath>
int main()
{
int box[128]={0};
string input;
cin>>input;
for(int i=0;i<input.length();i++){
box[input[i]]++;
}
cout<<box['A']<<" "
<<box['B']<<" "
<<box['C']<<" "
<<box['D']<<" "
<<box['E']<<" "
<<box['F']<<" "
<<box['G']<<" "
<<box['H']<<" ";
cout<<"\n";
int box2[128]={0};
cin>>input;
for(int i=0;i<input.length();i++){
box2[input[i]]++;
}
cout<<box2['A']<<" "
<<box2['B']<<" "
<<box2['C']<<" "
<<box2['D']<<" "
<<box2['E']<<" "
<<box2['F']<<" "
<<box2['G']<<" "
<<box2['H']<<" ";
printf("\n");
int box3[128]={0};
cin>>input;
int anagram=3;
for(int i=0;i<128;i++){
box3[i]=abs(box2[i]-box[i]);
//if(box3[i]==box2[i])anagram--;
anagram-=box[3];
}
cout<<box3['A']<<" "
<<box3['B']<<" "
<<box3['C']<<" "
<<box3['D']<<" "
<<box3['E']<<" "
<<box3['F']<<" "
<<box3['G']<<" "
<<box3['H']<<" ";
if(anagram<=0)printf("\nno");
else printf("\nanagram");
}