#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<string.h>
#include<stdio.h>
#include<math.h>
#include<functional>
#include <memory.h>
#include <stack>



using namespace std;



int main() {
    string s1;
    while(getline(cin,s1)){
        string s2;
        for(int i=0; i<s1.length(); i++){
            if(s1[i]==' ')s2+="101";
            if(s1[i]=='\'')s2+="000000";
            if(s1[i]==',')s2+="000011";
            if(s1[i]=='-')s2+="10010001";
            if(s1[i]=='.')s2+="010001";
            if(s1[i]=='?')s2+="000001";
            if(s1[i]=='A')s2+="100101";
            if(s1[i]=='B')s2+="10011010";
            if(s1[i]=='C')s2+="0101";
            if(s1[i]=='D')s2+="0001";
            if(s1[i]=='E')s2+="110";
            if(s1[i]=='F')s2+="01001";
            if(s1[i]=='G')s2+="10011011";
            if(s1[i]=='H')s2+="010000";
            if(s1[i]=='I')s2+="0111";
            if(s1[i]=='J')s2+="10011000";
            if(s1[i]=='K')s2+="0110";
            if(s1[i]=='L')s2+="00100";
            if(s1[i]=='M')s2+="10011001";
            if(s1[i]=='N')s2+="10011110";
            if(s1[i]=='O')s2+="00101";
            if(s1[i]=='P')s2+="111";
            if(s1[i]=='Q')s2+="10011111";
            if(s1[i]=='R')s2+="1000";
            if(s1[i]=='S')s2+="00110";
            if(s1[i]=='T')s2+="00111";
            if(s1[i]=='U')s2+="10011100";
            if(s1[i]=='V')s2+="10011101";
            if(s1[i]=='W')s2+="000010";
            if(s1[i]=='X')s2+="10010010";
            if(s1[i]=='Y')s2+="10010011";
            if(s1[i]=='Z')s2+="10010000";
            
        }
        for(int i=0; i<s2.length()%5; i++){
            s2+='0';
        }
        //cout<<s2<<endl;;
        
        string s3;
        
        
        for(int i=0; i<s2.length()/5; i++){
            string s;
            for(int j=0; j<5; j++){
                s+=s2[i*5+j];
            }
            
            if(s=="00000")s3+="A";
            if(s=="00001")s3+="B";
            if(s=="00010")s3+="C";
            if(s=="00011")s3+="D";
            if(s=="00100")s3+="E";
            if(s=="00101")s3+="F";
            if(s=="00110")s3+="G";
            if(s=="00111")s3+="H";
            if(s=="01000")s3+="I";
            if(s=="01001")s3+="J";
            if(s=="01010")s3+="K";
            if(s=="01011")s3+="L";
            if(s=="01100")s3+="M";
            if(s=="01101")s3+="N";
            if(s=="01110")s3+="O";
            if(s=="01111")s3+="P";
            if(s=="10000")s3+="Q";
            if(s=="10001")s3+="R";
            if(s=="10010")s3+="S";
            if(s=="10011")s3+="T";
            if(s=="10100")s3+="U";
            if(s=="10101")s3+="V";
            if(s=="10110")s3+="W";
            if(s=="10111")s3+="X";
            if(s=="11000")s3+="Y";
            if(s=="11001")s3+="Z";
            if(s=="11010")s3+=" ";
            if(s=="11011")s3+=".";
            if(s=="11100")s3+=",";
            if(s=="11101")s3+="-";
            if(s=="11110")s3+="'";
            if(s=="11111")s3+="?";

        }
        
        cout<<s3<<endl;
        
        
        
        
        
        
        
        
        
        
    }
}

Measured memory_bytes: 1188