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

string i_to_05b(unsigned int n){
	string s = "";
	do{
		char c = (n & 1U) + '0' ;
		s.push_back( c );
		n >>= 1;
	}while( n != 0 );

	while( s.size() < 5 ){
		s.push_back('0');
	}
	reverse( s.begin() , s.end() );
	
	return s;
}

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

void makeTable2(map<string,char>& table2){
	char ch[6] = { ' ' , '.' , ',' , '-' , '\'' , '?' };
	for(char c = 'A' ; c <= 'Z' ; ++c){
		table2[ i_to_05b( (int)(c - 'A') ) ] = c;
	}
	for(int i = 0 ; i < 6 ; ++i ){
		table2[ i_to_05b( i+26 ) ] = ch[i];
	}
}

string encode(string p, map<char,string> table1){
	string c = "";
	for(int i=0 ; i<p.size() ; ++i ){
		c += table1[ p[i] ];
	}
	return c;
}
string decode(string c , map<string,char> table2){
	string p = "";
	while( c.size() % 5 != 0){
		c.push_back('0');
	}
	for(int i=0 ; i+5 <= c.size() ; i += 5 ){
		p.push_back( table2[ c.substr( i , 5 ) ] );
	}
	return p;
}

int main(){
	string p;
	map<char,string> table1;
	map<string,char> table2;
	makeTable1(table1);
	makeTable2(table2);

	while( getline( cin , p ) ){
		cout << decode( encode( p , table1 ) , table2 ) << endl;
	}
}