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