#include <iostream>
#include <string>
#include <map>


int main()
{
	std::map<char,std::string> enc1;
	enc1[' ']  = "101";
	enc1['\''] = "000000";
	enc1[',']  = "000011";
	enc1['-']  = "10010001";
	enc1['.']  = "010001";
	enc1['?']  = "000001";
	enc1['A']  = "100101";
	enc1['B']  = "10011010";
	enc1['C']  = "0101";
	enc1['D']  = "0001";
	enc1['E']  = "110";
	enc1['F']  = "01001";
	enc1['G']  = "10011011";
	enc1['H']  = "010000";
	enc1['I']  = "0111";
	enc1['J']  = "10011000";
	enc1['K']  = "0110";
	enc1['L']  = "00100";
	enc1['M']  = "10011001";
	enc1['N']  = "10011110";
	enc1['O']  = "00101";
	enc1['P']  = "111";
	enc1['Q']  = "10011111";
	enc1['R']  = "1000";
	enc1['S']  = "00110";
	enc1['T']  = "00111";
	enc1['U']  = "10011100";
	enc1['V']  = "10011101";
	enc1['W']  = "000010";
	enc1['X']  = "10010010";
	enc1['Y']  = "10010011";
	enc1['Z']  = "10010000";
	
	std::map<std::string,char> enc2;
	enc2["00000"] = 'A';
	enc2["00001"] = 'B';
	enc2["00010"] = 'C';
	enc2["00011"] = 'D';
	enc2["00100"] = 'E';
	enc2["00101"] = 'F';
	enc2["00110"] = 'G';
	enc2["00111"] = 'H';
	enc2["01000"] = 'I';
	enc2["01001"] = 'J';
	enc2["01010"] = 'K';
	enc2["01011"] = 'L';
	enc2["01100"] = 'M';
	enc2["01101"] = 'N';
	enc2["01110"] = 'O';
	enc2["01111"] = 'P';
	enc2["10000"] = 'Q';
	enc2["10001"] = 'R';
	enc2["10010"] = 'S';
	enc2["10011"] = 'T';
	enc2["10100"] = 'U';
	enc2["10101"] = 'V';
	enc2["10110"] = 'W';
	enc2["10111"] = 'X';
	enc2["11000"] = 'Y';
	enc2["11001"] = 'Z';
	enc2["11010"] = ' ';
	enc2["11011"] = '.';
	enc2["11100"] = ',';
	enc2["11101"] = '-';
	enc2["11110"] = '\'';
	enc2["11111"] = '?';
	
	std::string buf;
	while (std::getline(std::cin, buf)) {
		std::string after_enc1 = "";
		for (int i=0; i<buf.length(); i++) {
			after_enc1 += enc1[buf[i]];
		}
		std::string after_enc2 = "";
		for (int offset=0; offset<after_enc1.length(); offset+=5) {
			std::string tmp = after_enc1.substr(offset, 5);
			while (tmp.length()<5) tmp += "0";
			after_enc2 += enc2[tmp];
		}
		std::cout << after_enc2 << std::endl;
	}

	return 0;
}
			

