#include<iostream>
#include<deque>
#include<algorithm>
#include<functional>
#include<string>
#include<unordered_map>
using namespace std;

unordered_map<char, string>U;
string b[26] = {
	"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",
};
char t[6]{ ' ','.',',','-','\'','?' };
signed main() {
	U[' '] = "101";
	U['\''] = "000000";
	U[','] = "000011";
	U['-'] = "10010001";
	U['.'] = "010001";
	U['?'] = "000001";
	string a;
	while (getline(cin, a)) {
		string c;
		for (char d : a) {
			if (d >= 'A'&&d <= 'Z') {
				c += b[d - 'A'];
			}
			else c += U[d];
		}
		int d = c.length() / 5;
		if (c.length() % 5)d++;
		c += "0000";
		for (int e = 0; e < d; e++) {
			string k = c.substr(e * 5, 5);
			int S = 0;
			for (int i = 0; i < 5; i++) {
				if (k[i] == '1') {
					S += 1 << (4 - i);
				}
			}
			if (S <= 25) { cout << char(S + 'A'); }
			else cout << t[S - 26];
		}
		cout << endl;
	}
}