#include <iostream>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <map>
#include <cmath>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


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

		string wws="", ans="";
		rep(i, ws.size()) wws += aa[ws[i]];
		while(wws.size() % 5 !=0) wws += '0';
//		cout << wws <<endl;
		for(int i=0;i<=wws.size() ;i+=5){
			string mws = wws.substr(i,5);
			ans += bb[mws];
		}
		if(cin.eof()) break;
		cout << ans << endl;
	}

	return 0;
	
}