#include<iostream>
#include<string>
#include<map>
using namespace std;
map<char, string>m1;
map<string, char>m2;
void f1() {
    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'] = "00100";
    m1['T'] = "00111";
    m1['U'] = "10011100";
    m1['V'] = "10011101";
    m1['W'] = "000010";
    m1['X'] = "10010010";
    m1['Y'] = "10010011";
    m1['Z'] = "10010000";
}
void f2() {
    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"] = '?';
}
int main() {
    string s, str, ans; f1(); f2(); 
    bool b = false;
    while (getline(cin, s)) {
        if (b) str += m1[' '];
        for (int i = 0; i < s.size(); i++) {
            str += m1[s[i]];
            if (str.size() >= 5) {
                while (str.size() >= 5) {
                    ans += m2[str.substr(0, 5)];
                    str.erase(str.begin(), str.begin() + 6);
                }
            }
        }
        b = true;
    }
    if (str.size() > 0) {
        int n = str.size();
        for (int i = 0; i < 5 - n; i++)str += '0';
        ans += m2[str];
    }
    cout << ans << endl;
}