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

int main()
{
	int i, j;
	string s, st;
	map<char, string> toCode;
	map<string, char> toA;

	toCode[' '] = "101";
	toCode['\''] = "000000";
	toCode[','] = "000011";
	toCode['-'] = "10010001";
	toCode['.'] = "010001";
	toCode['?'] = "000001";
	toCode['A'] = "100101";
	toCode['B'] = "10011010";
	toCode['C'] = "0101";
	toCode['D'] = "0001";
	toCode['E'] = "110";
	toCode['F'] = "01001";
	toCode['G'] = "10011011";
	toCode['H'] = "010000";
	toCode['I'] = "0111";
	toCode['J'] = "10011000";
	toCode['K'] = "0110";
	toCode['L'] = "00100";
	toCode['M'] = "10011001";
	toCode['N'] = "10011110";
	toCode['O'] = "00101";
	toCode['P'] = "111";
	toCode['Q'] = "10011111";
	toCode['R'] = "1000";
	toCode['S'] = "00110";
	toCode['T'] = "00111";
	toCode['U'] = "10011100";
	toCode['V'] = "10011101";
	toCode['W'] = "000010";
	toCode['X'] = "10010010";
	toCode['Y'] = "10010011";
	toCode['Z'] = "10010000";
	toA["00000"] = 'A';
	toA["00001"] = 'B';
	toA["00010"] = 'C';
	toA["00011"] = 'D';
	toA["00100"] = 'E';
	toA["00101"] = 'F';
	toA["00110"] = 'G';
	toA["00111"] = 'H';
	toA["01000"] = 'I';
	toA["01001"] = 'J';
	toA["01010"] = 'K';
	toA["01011"] = 'L';
	toA["01100"] = 'M';
	toA["01101"] = 'N';
	toA["01110"] = 'O';
	toA["01111"] = 'P';
	toA["10000"] = 'Q';
	toA["10001"] = 'R';
	toA["10010"] = 'S';
	toA["10011"] = 'T';
	toA["10100"] = 'U';
	toA["10101"] = 'V';
	toA["10110"] = 'W';
	toA["10111"] = 'X';
	toA["11000"] = 'Y';
	toA["11001"] = 'Z';
	toA["11010"] = ' ';
	toA["11011"] = '.';
	toA["11100"] = ',';
	toA["11101"] = '-';
	toA["11110"] = '\'';
	toA["11111"] = '?';

	while (getline(cin, s)) {
		st = "";
		for (i = 0; i < s.size(); i++) st += toCode[s[i]];

		if ( st.size()%5 )
			for (i = 5 - st.size()%5; i > 0; i--)
				st += "0";

		for (i = 0; i < st.size()/5; i++) {
			s = st.substr( i*5, 5 );
			cout << toA[s];
		}
		cout<<endl;
	}

	return 0;
}