#include<iostream>
using namespace std;

int main(){
    string g,t,tem,
        s="ABCDEFGHIJKLMNOPQRSTUVWXYZ ',-.?",
        str[34]={
            "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",
            "101","000000","000011","10010001","010001","000001"
        };
    getline(cin,g);
    for(int i=0;i<g.length();i++)
        switch(g[i]){
            case ' ': t+=str[26];break;
            case '\'':t+=str[27];break;
            case ',': t+=str[28];break;
            case '-': t+=str[29];break;
            case '.': t+=str[30];break;
            case '?': t+=str[31];break;
            default:  t+=str[g[i]-'A'];
        }
    while(t.length()%5)t+='0';
    g="";
    for(int i=0;i<t.length();i++){
        tem+=t[i];
        if(tem.length()==5){
            int n=0;
            for(int j=0;j<5;j++)
                n=n*2+tem[j]-'0';
            switch (n){
                case 26:g+=' ';break;
                case 27:g+='.';break;
                case 28:g+=',';break;
                case 29:g+='-';break;
                case 30:g+='\'';break;
                case 31:g+='?';break;
                default:g+='A'+n;
            }
            tem="";
        }
    }
    cout<<g<<endl;
}