#include<bits/stdc++.h>
using namespace std;
int main()
{
    string str,Midstream;
    getline(cin,str);
    string first=" ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ",secound="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
    string conversion[32]={"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"};
    for(int i=0;str[i]!='\0';i++){
        for(int j=0;j<32;j++)if(str[i]==first[j])Midstream+=conversion[j];
    }
    for(int i=0;i<Midstream.size()%5;i++)Midstream+='0';
    for(int i=0,point=0;Midstream[i]!='\0';i++){
        if(i%5==4){
            int num=0;
            for(int j=point,kawa[5]={1,2,4,8,16};j<=i;j++)num+=(Midstream[j]-'0')*kawa[i-j];
            cout<<secound[num];
            point=i+1;
        }
    }
    cout<<endl;
}