#include"bits/stdc++.h"
using namespace std;int main(){string s;while(getline(cin,s)){string c;for(auto i:s)c+=i==' '?"101":i=='\''?"000000":i==','?"000011":i=='-'?"10010001":i=='.'?"010001":i=='?'?"000001":i=='A'?"100101":i=='B'?"10011010":i=='C'?"0101":i=='D'?"0001":i=='E'?"110":i=='F'?"01001":i=='G'?"10011011":i=='H'?"010000":i=='I'?"0111":i=='J'?"10011000":i=='K'?"0110":i=='L'?"00100":i=='M'?"10011001":i=='N'?"10011110":i=='O'?"00101":i=='P'?"111":i=='Q'?"10011111":i=='R'?"1000":i=='S'?"00110":i=='T'?"00111":i=='U'?"10011100":i=='V'?"10011101":i=='W'?"000010":i=='X'?"10010010":i=='Y'?"10010011":"10010000";for(int j=0,k=c.length();j<(5-k%5)%5;++j)c+='0';for(int j=0;j<c.length();j+=5){int b=(c[j]-'0')*16+(c[j+1]-'0')*8+(c[j+2]-'0')*4+(c[j+3]-'0')*2+(c[j+4]-'0');cout<<(b<26?(char)('A'+b):" .,-'?"[b-26]);}cout<<endl;}}
