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

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

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

int main( void )
{
    string line;
    getline( cin, line );
    
    string str1 = line;
    string str2 = "";
    for ( string ::iterator it = str1.begin(); it != str1.end(); ++it ) {
        str2 += convert( *it );
    }
    string app( 5-(str2.size()%5), '0' );
    str2 += app;

    string str3 = "";
    for ( int i = 0; i < (int)str2.size(); i += 5 ) {
        char c = convert( str2.substr( i, 5 ) );
        str3 += c;
    }

    cout << str3 << endl;

    return 0;
}