Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: un8qe_x3

Problemset: อะนาแกรม 2

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-26 17:19:24

#include<bits/stdc++.h>
using namespace std;
#define i_ int
#define s_ string
#define sttc(f,a) static_cast<f>(a)
int main(){
    s_ s;cin >> s;s_ a;cin >> a;
    i_ g[8] = {0},d[8] = {0},r=s.size(),t=a.size();
    while (r--) {g[sttc(i_,s[r])-65]++;}
    while (t--) {d[sttc(i_,a[t])-65]++;}
    i_ i[8];int o=8;while (o--) {i[o] = abs(g[o]-d[o]);}
    for (i_ e=0;e<8;e++) {cout << g[e];if (e-7){cout << " ";}}
    cout << "\n";
    for (i_ e=0;e<8;e++) {cout << d[e];if (e-7){cout << " ";}}
    cout << "\n";
    for (i_ e=0;e<8;e++) {cout << i[e];if (e-7){cout << " ";}}
    cout << "\n";
    i_ ii=0,iii=8;while (iii--) {if (i[iii]){ii++;}}
    if (ii<4){cout << "anagram";}
    else {cout << "no";}
    return 0;
}