Submission

Status:

Compilation Error

Subtask/Task Score:

Score: 0

User: speed_coding

Problemset: อะนาแกรม 2

Language: cpp

Time: 0.000 second

Submitted On: 2026-10-08 20:59:54

#include<bits/stdc++.h>
using namespace std;
int main(){
	string str1 , str2;
	cin >> str1 >> str2 ;
	int count1[0] = {0} ;
	int count2[0] = {0} ;
	int diff[0] = {0} ;
	int total_diff = 0;
	for(int i = 0; i < str1.length(); i++){
		char c = str1[i] ;
		count1[c - 'A']++;
	}
	for(int i = 0; i < str2.length(); i++){
		char c = str2[i] ;
		count2[c - 'A']++;
	}
	for(int i = 0; i < 8; i++){
		diff[i] = abs(count1[i] - count2[i])
		total_diff += diff[i]
	}
	for(int i = 0; i < 8 ; i++){
	    cout << count1[i] << (i == 7 ? "\n" : " "); 
	}
	for(int i = 0; i < 8 ; i++){
	    cout << count2[i] << (i == 7 ? "\n" : " "); 
	}
	for(int i = 0; i < 8 ; i++){
	    cout << diff[i] << (i == 7 ? "\n" : " "); 
	}
	if(total_diff <= 3){
		cout << "anagram\n" ;
	}
	else{
		cout << "no\n" ;
	}
}