#include<bits/stdc++.h>
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
map<char, string>m1; map<string, char>m2;
signed main() {
	{
		m1[' '] = "101";
		m1['\''] = "000000";
		m1[','] = "000011";
		m1['-'] = "10010001";
		m1['.'] = "010001";
		m1['?'] = "000001";
		m1['A'] = "100101";
		m1['B'] = "10011010";
		m1['C'] = "0101";
		m1['D'] = "0001";
		m1['E'] = "110";
		m1['F'] = "01001";
		m1['G'] = "10011011";
		m1['H'] = "010000";
		m1['I'] = "0111";
		m1['J'] = "10011000";
		m1['K'] = "0110";
		m1['L'] = "00100";
		m1['M'] = "10011001";
		m1['N'] = "10011110";
		m1['O'] = "00101";
		m1['P'] = "111";
		m1['Q'] = "10011111";
		m1['R'] = "1000";
		m1['S'] = "00110";
		m1['T'] = "00111";
		m1['U'] = "10011100";
		m1['V'] = "10011101";
		m1['W'] = "000010";
		m1['X'] = "10010010";
		m1['Y'] = "10010011";
		m1['Z'] = "10010000";
	}
	{
		m2["00000"] = 'A';
		m2["00001"] = 'B';
		m2["00010"] = 'C';
		m2["00011"] = 'D';
		m2["00100"] = 'E';
		m2["00101"] = 'F';
		m2["00110"] = 'G';
		m2["00111"] = 'H';
		m2["01000"] = 'I';
		m2["01001"] = 'J';
		m2["01010"] = 'K';
		m2["01011"] = 'L';
		m2["01100"] = 'M';
		m2["01101"] = 'N';
		m2["01110"] = 'O';
		m2["01111"] = 'P';
		m2["10000"] = 'Q';
		m2["10001"] = 'R';
		m2["10010"] = 'S';
		m2["10011"] = 'T';
		m2["10100"] = 'U';
		m2["10101"] = 'V';
		m2["10110"] = 'W';
		m2["10111"] = 'X';
		m2["11000"] = 'Y';
		m2["11001"] = 'Z';
		m2["11010"] = ' ';
		m2["11011"] = '.';
		m2["11100"] = ',';
		m2["11101"] = '-';
		m2["11110"] = '\'';
		m2["11111"] = '?';
	}

	string s;
	while (getline(cin, s)) {
		string s1 = "", ans = "";
		for (char ch : s) s1 += m1[ch];
		while (s1.size() % 5 != 0)s1 += '0';
		for (int i = 0; i < s1.size(); i += 5) ans += m2[s1.substr(i, 5)];
		cout << ans << endl;
	}
}
