#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
#include<string>
using namespace std;
int pow(string sub){
    int r=0,t=1;
    for(int i=4;i>=0;i--){
        if(sub[i]=='1')r+=t;
        t*=2;
    }
    return r;
}
int main(){
    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 lis="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-\'?";
    string str;
    while(getline(cin,str)){
        string ans;
        for(int i=0;i<str.length();i++){
            ans+=enc[str[i]];
        }
        for(int i=0;i<ans.length()%5;i++){
            ans+="0";
        }
        string Code;
        for(int i=0;i<ans.length()/5;i++){
            int value=pow(ans.substr(i*5,(i*5)+5));
            Code+=lis[value];
        }
        cout<<Code<<endl;
    }

}