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

map<char, string> tr1;
map<string, char> tr2;

int main() {
	tr1[' '] = "101";
	tr1['\''] = "000000";
	tr1[','] = "000011";
	tr1['-'] = "10010001";
	tr1['.'] = "010001";
	tr1['?'] = "000001";
	tr1['A'] = "100101";
	tr1['B'] = "10011010";
	tr1['C'] = "0101";
	tr1['D'] = "0001";
	tr1['E'] = "110";
	tr1['F'] = "01001";
	tr1['G'] = "10011011";
	tr1['H'] = "010000";
	tr1['I'] = "0111";
	tr1['J'] = "10011000";
	tr1['K'] = "0110";
	tr1['L'] = "00100";
	tr1['M'] = "10011001";
	tr1['N'] = "10011110";
	tr1['O'] = "00101";
	tr1['P'] = "111";
	tr1['Q'] = "10011111";
	tr1['R'] = "1000";
	tr1['S'] = "00110";
	tr1['T'] = "00111";
	tr1['U'] = "10011100";
	tr1['V'] = "10011101";
	tr1['W'] = "000010";
	tr1['X'] = "10010010";
	tr1['Y'] = "10010011";
	tr1['Z'] = "10010000";

	tr2["00000"] = 'A';	
	tr2["00001"] = 'B';	
	tr2["00010"] = 'C';	
	tr2["00011"] = 'D';	
	tr2["00100"] = 'E';	
	tr2["00101"] = 'F';	
	tr2["00110"] = 'G';	
	tr2["00111"] = 'H';	
	tr2["01000"] = 'I';	
	tr2["01001"] = 'J';	
	tr2["01010"] = 'K';	
	tr2["01011"] = 'L';	
	tr2["01100"] = 'M';	
	tr2["01101"] = 'N';	
	tr2["01110"] = 'O';	
	tr2["01111"] = 'P';	
	tr2["10000"] = 'Q';	
	tr2["10001"] = 'R';	
	tr2["10010"] = 'S';	
	tr2["10011"] = 'T';	
	tr2["10100"] = 'U';	
	tr2["10101"] = 'V';	
	tr2["10110"] = 'W';	
	tr2["10111"] = 'X';	
	tr2["11000"] = 'Y';	
	tr2["11001"] = 'Z';	
	tr2["11010"] = ' ';	
	tr2["11011"] = '.';	
	tr2["11100"] = ',';	
	tr2["11101"] = '-';	
	tr2["11110"] = '\'';	
	tr2["11111"] = '?';	
	
	string str;
	while (getline(cin, str)) {
		string tmp = "";
		for (int i=0; i<str.size(); i++)
			tmp += tr1[str[i]];

		int s = tmp.size() % 5;
		if (s != 0) 
			for (int i=0; i<5-s; i++)
				tmp += "0";

		for (int i=0; i<tmp.size()/5; i++)
			cout << tr2[tmp.substr(i*5, 5)];

		cout << endl;
	}
	return 0;
}