Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: shurye
Problemset: อะนาแกรม 2
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-11 21:24:03
#include <iostream>
#include <vector>
#include <cmath>
using namespace std ;
vector <int> aToh1 (8,0);
vector <int> aToh2 (8,0);
int main(){
string text ,text2 ;
cin >> text >> text2;
for(auto i : text){
aToh1[int(i)-65] ++ ;
}
for(auto i : aToh1){
cout << i << " " ;
}cout << "\n" ;
for(auto i : text2){
aToh2[int(i)-65] ++ ;
}
for(auto i : aToh2){
cout << i << " " ;
}cout << "\n" ; int c = 0;
for(int i = 0 ; i <8 ; i ++){
c += abs(aToh1[i] - aToh2[i]) ;
cout << abs(aToh1[i] - aToh2[i]) << " ";
}cout << "\n" ;
cout << (c <= 3 ? "anagram" : "no");
}