Submission

Status:

----------

Subtask/Task Score:

0/100

Score: 0

User: Waranyu.arty

Problemset: อะนาแกรม 2

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-05 17:08:32

#include<iostream>
using namespace std;
int main(){
    string str;
    string str2;
    cin>>str;
    cin>>str2;
    int count[30] = {0};
    int count2[30] = {0};
    for(int i=0;i<8;i++){
        count[str[i]-'A']++;
        cout<<count[i]<<" ";
        
    }
    cout<<"\n";
    for(int i=0;i<8;i++){
        count2[str2[i]-'A']++;
        cout<<count2[i]<<" ";
    }
    cout<<"\n";
    bool anagram = true;
    int count3=0;
    for(int i=0;i<8;i++){
        int x=abs((count[i]+'A')-(count2[i]+'A'));
        if (x!=0) count3++;
        cout<<x<<" ";
    }
    cout<<"\n";
    if (count3>3) cout<<"no";
    else cout<<"anagram";
    

}