Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Neozaawwman1

Problemset: อะนาแกรม 2

Language: cpp

Time: 0.003 second

Submitted On: 2025-10-09 08:51:50

#include <bits/stdc++.h>
using namespace std;
int Charcheck1[8];
int Charcheck2[8];
int diff[8];
void check(string text, int (&Charcheck)[8]){
	for(int i=0; i<text.length(); i++){
		Charcheck[text[i]-'A']++;
	}
	for(int i=0; i<8; i++){
		cout<<Charcheck[i]<<" ";
	}
	cout<<endl;
}
int main(){
	string text1, text2;cin>>text1>>text2;
	check(text1, Charcheck1);
	check(text2, Charcheck2);
	int sum=0;
	for(int i=0; i<8; i++){
		diff[i]=Charcheck1[i]-Charcheck2[i];
		if(diff[i]<0){
			diff[i]*=-1;
		}
		sum+=diff[i];
	}
	for(int i=0; i<8; i++){
		cout<<diff[i]<<" ";
	}
	cout<<endl;
	if(sum>3){
		cout<<"no";
	}else{
		cout<<"anagram";
	}
	return 0;
}