#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main(){
long i,j,k;
string s,t,u[59]={
"101","","","","","","","000000","","",
"","","000011","10010001","010001","","","","","",
"","","","","","","","","","",
"","000001","","100101","10011010","0101","0001","110","01001","10011011",
"010000","0111","10011000","0110","00100","10011001","10011110","00101","111","10011111",
"1000","00110","00111","10011100","10011101","000010","10010010","10010011","10010000",
},v="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
while(getline(cin,s)){
for(t="",i=0;i<s.size();i++)t+=u[s[i]-32];
j=t.size();
k=((j-1)/5+1)*5;
for(i=0;i<k-j;i++)t+='0';
for(i=j=0;i<k;i++){
if(i>0&&i%5==0){cout<<v[j];j=0;}
j<<=1;j+=t[i]-48;
}
cout<<v[j]<<endl;
}
return 0;
}