Submission

Status:

PPPPPPPP-P

Subtask/Task Score:

90/100

Score: 90

User: cyblox_boi

Problemset: อะนาแกรม 2

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-22 20:56:01

#include <iostream>
#include <map>
#include <vector>
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	vector<string> words(2);
	vector<map<char, int>> countAlphabet(2);

	for (int i = 0; i < 2; i++) {
		cin >> words[i];

		for (const char &ch : words[i]) {
			countAlphabet[i][ch]++;
		}
	}

	for (int i = 0; i < 2; i++) {
		for (char j = 'A'; j <= 'H'; j++) {
			cout << countAlphabet[i][j] << ' ';
		}

		cout << '\n';
	}
	
	int countDifferent = 0;

	for (char i = 'A'; i <= 'H'; i++) {
		if (countAlphabet[0][i] != countAlphabet[1][i]) {
			countDifferent++;
			
			cout << 1;
		} else {
			cout << 0;
		}
		
		cout << ' ';
	}
	
	cout << '\n';
	
	if (countDifferent > 3) {
		cout << "no";
	} else {
		cout << "anagram";
	}
	
	cout << '\n';

	return 0;
}