Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: porpeang
Problemset: อะนาแกรม 2
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-05 19:07:53
#include <bits/stdc++.h>
using namespace std;
int main(){
int a=0,b=0,c=0,d=0,e=0,f=0,g=0;
string q;
cin>>q;
string p;
cin>>p;
int arr[8]={};
int art[8]={};
for(int i=0;i<q.size();i++){
arr[q[i]-'A']+=1;
}
for(int t=0;t<p.size();t++){
art[p[t]-'A']+=1;
}
for(int j=0;j<8;j++){
if(arr[j]!=art[j]){
e++;
}
}
for(int k=0;k<8;k++){
cout<<arr[k]<<" ";
}
cout<<'\n';
for(int l=0;l<8;l++){
cout<<art[l]<<" ";
}
cout<<'\n';
for(int d=0;d<8;d++){
if((arr[d]-art[d])<0){
cout<<(art[d]-arr[d])<<" ";
}
else{
cout<<(arr[d]-art[d])<<" ";
}
}
cout<<'\n';
if(e<=3){
cout<<"anagram";
}
else{
cout<<"no";
}
}