/*
Nome: Mario
Cognome: Montanari

Convertire una stringa in alfabeto carbonaro.
*/

#include <iostream>
#include <cctype>
#include <cstring>

#define SIZE 100+1

using namespace std;

void alfCarbonaro(char mssg[], const char alfCarb[]);

int main(void) {
	const char alfCarb[] = "OPGTIVCHE  RNMABQLZDUF   S";
	char mssg[SIZE];     // ABCDEFGHI  LMNOPQRSTUV   Z
	
	cout << "Inserisci una parola: ";
	cin >> mssg;
	
	alfCarbonaro(mssg, alfCarb);
	
	return 0;
}

void alfCarbonaro(char mssg[], const char alfCarb[]) {
	int r;
	for (int i = 0; mssg[i] != '\0'; i++) {
		r = toupper(mssg[i]) - 'A';
		mssg[i] = alfCarb[r];
		
		if (alfCarb[r] == ' ') {
			cout << "Parola non valida!" << endl;
			return;
		}
	}
	
	cout << mssg;
}