#include<iostream>
#include<string>
#include<map>
#include<cmath>
using namespace std;
int change(string x);
int main(void){
    string str,str2;
    map<char,string> enc;
    enc[' '] = "101";
    enc['\''] = "000000";
    enc[','] = "000011";
    enc['-'] = "10010001";
    enc['.'] = "010001";
    enc['?'] = "000001";
    enc['A'] = "100101";
    enc['B'] = "10011010";
    enc['C'] = "0101";
    enc['D'] = "0001";
    enc['E'] = "110";
    enc['F'] = "01001";
    enc['G'] = "10011011";
    enc['H'] = "010000";
    enc['I'] = "0111";
    enc['J'] = "10011000";
    enc['K'] = "0110";
    enc['L'] = "00100";
    enc['M'] = "10011001";
    enc['N'] = "10011110";
    enc['O'] = "00101";
    enc['P'] = "111";
    enc['Q'] = "10011111";
    enc['R'] = "1000";
    enc['S'] = "00110";
    enc['T'] = "00111";
    enc['U'] = "10011100";
    enc['V'] = "10011101";
    enc['W'] = "000010";
    enc['X'] = "10010010";
    enc['Y'] = "10010011";
    enc['Z'] = "10010000";
    string dec = "ABCDEFGHIJKLMNOPQRSTUVWXYZ \',-.?";
    string ans="",sub="";
    while(getline(cin,str)){
        for(int i=0;i<str.length();i++){
            str2+=enc[str[i]];
        }
        for(int i=0;i<str2.length()%5;i++){
            str2+='0';
        }
        for(int i=0;i<str2.length()/5;i++){
            ans+=str2[5*i];
            ans+=str2[5*i+1];
            ans+=str2[5*i+2];
            ans+=str2[5*i+3];
            ans+=str2[5*i+4];
            sub+=dec[change(ans)];
            ans="";
        }
        cout<<sub<<endl;
        sub=str2=str=ans="";
    }
    return 0;
}
int change(string x){
    int re=0;
    for(int i=x.length()-1,j=0;i>=0;i--,j++){
        if(x[i]=='1')re+=pow(2,j);
    }
    return re;
}