#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
	string abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
	string abcc[32] = {"100101", "10011010", "0101", "0001", "110", "01001",
					   "10011011", "010000", "0111", "10011000", "0110", "00100",
					   "10011001", "10011110", "00101", "111", "10011111", "1000",
					   "00110", "00111", "10011100", "10011101", "000010", "10010010",
					   "10010011", "10010000", "101", "010001", "000011", "10010001", "000000", "000001"};
	string zo = "01";
	string abcd[32];
	for (int i = 0; i < 32; i++) {
		string c = "";
		string d = "";
		int t = i;
		for (int j = 0; j < 5; j++) {
			c += zo[t%2];
			t /= 2;

		}
		for (int j = 4; j >= 0; j--) {
			d += c[j];
		}
		abcd[i] = d;
	}
	string a;
	while (getline(cin, a)) {
		string b = "";
		for (int i = 0; i < a.size(); i++) {
			for (int j = 0; j < abc.size(); j++) {
				if (a[i] == abc[j]) {
					b += abcc[j];
					break;
				}
			}
		}
		while (b.size() % 5 != 0) {
			b += '0';
		}
		while (true) {
			for (int j = 0; j < 32; j++) {
				if (b.substr(0, 5) == abcd[j]) {
					cout << abc[j];
					break;
				}
			}
			if (b.size() == 5) {
				break;
			} else {
				b = b.substr(5);
			}
		}
		cout << endl;
	}
	return 0;
}