#include<iostream>
#include<map>
#include<string>
using namespace std;

int main()
{
    string str;
    map<char,string> m1;
    m1[' '] = "101";
    m1['\''] = "000000";  
    m1[','] = "000011";
    m1['-'] = "10010001";
    m1['.'] = "010001";
    m1['?'] = "000001";        
    m1['A'] = "100101";
    m1['B'] = "10011010";
    m1['C'] = "0101";
    m1['D'] = "0001";
    m1['E'] = "110";
    m1['F'] = "01001";
    m1['G'] = "10011011";
    m1['H'] = "010000";
    m1['I'] = "0111";
    m1['J'] = "10011000";
    m1['K'] = "0110";
    m1['L'] = "00100";
    m1['M'] = "10011001";
    m1['N'] = "10011110";
    m1['O'] = "00101";
    m1['P'] = "111";
    m1['Q'] = "10011111";
    m1['R'] = "1000";
    m1['S'] = "00110";
    m1['T'] = "00111";
    m1['U'] = "10011100";
    m1['V'] = "10011101";
    m1['W'] = "000010";
    m1['X'] = "10010010";
    m1['Y'] = "10010011";
    m1['Z'] = "10010000";

    map<string,char> m2;
    m2["00000"] = 'A';
    m2["00001"] = 'B';
    m2["00010"] = 'C';
    m2["00011"] = 'D';
    m2["00100"] = 'E';
    m2["00101"] = 'F';
    m2["00110"] = 'G';
    m2["00111"] = 'H';
    m2["01000"] = 'I';
    m2["01001"] = 'J';
    m2["01010"] = 'K';
    m2["01011"] = 'L';
    m2["01100"] = 'M';
    m2["01101"] = 'N';
    m2["01110"] = 'O';
    m2["01111"] = 'P';
    m2["10000"] = 'Q';
    m2["10001"] = 'R';
    m2["10010"] = 'S';
    m2["10011"] = 'T';
    m2["10100"] = 'U';
    m2["10101"] = 'V';
    m2["10110"] = 'W';
    m2["10111"] = 'X';
    m2["11000"] = 'Y';
    m2["11001"] = 'Z';
    m2["11010"] = ' ';
    m2["11011"] = '.';
    m2["11100"] = ',';
    m2["11101"] = '-';
    m2["11110"] = '\'';
    m2["11111"] = '?';

    while( getline(cin,str) )
    {
        string conv = "";
        for( int i = 0; i < str.size(); i++ )
            conv += m1[str[i]];

        string res = "";
        for( int i = 0; i < conv.size(); i++ )
        {
            res += conv[i];
            if( i % 5 == 4 )
            {
                cout << m2[res];
                res = "";
            }
        }
        while( res.size() != 0 && res.size() < 5 )
            res += "0";
        if( res.size() == 5 )
            cout << m2[res];
        cout << endl;
    }
    return 0;
}
