Submission

Status:

----------

Subtask/Task Score:

0/100

Score: 0

User: nate213121

Problemset: อะนาแกรม 2

Language: cpp

Time: 0.005 second

Submitted On: 2026-09-17 20:33:23

#include <bits/stdc++.h>

using namespace std;

int main()
{
    string in1;
    cin >> in1;
    string in2;
    cin >> in2;
    map<char, int> m1;
    m1['A'] = 0;
    m1['B'] = 0;
    m1['C'] = 0;
    m1['D'] = 0;
    m1['E'] = 0;
    m1['F'] = 0;
    m1['G'] = 0;
    m1['H'] = 0;
    map<char, int> m2 = m1;

    for(auto& c:in1)
    {
        m1[c]++;
    }
    for(auto& c:in2)
    {
        m2[c]++;
    }
    int c = 0;
    for(auto& x:m1)
    {
        c += abs(x.second - m2[x.first]);
        cout << abs(x.second - m2[x.first]) << " ";
    }
    if(c <= 3)
    {
        cout << "anagram";
    }
    else
    {
        cout << "no";
    }
}