#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>
  
using namespace std;
  
#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)



int main(){
	while(1){
	string cc[333];
	
	cc[' ']="101";
	cc['\'']="000000";
	cc[',']="000011";
	cc['-']="10010001";
	cc['.']="010001";
	cc['?']="000001";
	
	cc['A']="100101";
	cc['B']="10011010";
	
	cc['C']="0101";
	cc['D']="0001";
	cc['E']="110";
	cc['F']="01001";
	cc['G']="10011011";
	cc['H']="010000";
	cc['I']="0111";
	cc['J']="10011000";
	
	cc['K']="0110";
	cc['L']="00100";
	cc['M']="10011001";
	cc['N']="10011110";
	cc['O']="00101";
	cc['P']="111";
	cc['Q']="10011111";
	cc['R']="1000";
	
	cc['S']="00110";
	cc['T']="00111";
	cc['U']="10011100";
	cc['V']="10011101";
	cc['W']="000010";
	cc['X']="10010010";
	cc['Y']="10010011";
	cc['Z']="10010000";
	
	
	map<int,char> dd;
	rep(i,26){
		dd[i]='A'+i;
	}
	dd[26]=' ';
	dd[27]='.';
	dd[28]=',';
	dd[29]='-';
	dd[30]='\'';
	dd[31]='?';
	
	
	string str="";
	string in;
	while(1){
		getline(cin,in);
		if(cin.eof())break;
		if(str.size()!=0)str+=" ";
		str += in;
		break;
	}
	
	if(cin.eof())break;
	
	
	string conv="";
	rep(i,str.size()){
		conv += cc[str[i]];
	}
	
	while(conv.size()%5!=0){
		conv += "0";
	}
	string ans;
	
	for(int i=0;i<conv.size();i+=5){
		
		int num = 0;
		rep(j,5){
			num += (conv[i+j]-'0')*(1<<(4-j));
		}
		
		ans += dd[num];
	}
	
	cout<<ans<<endl;
	}
}