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