#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59

int main()
{
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    //cout << fixed << setprecision(7);

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

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

    string s;
    while (getline(cin, s))
    {
        string en = "";
        for (int i = 0; i < (int)s.size(); ++i)
        {
            en += mp1[s[i]];
        }
        //cout << en << endl;

        string ans = "";
        for (int i = 0; i < (int)en.size(); i += 5)
        {
            string p = "";
            if (i + 5 < (int)en.size())
            {
                p = en.substr(i, 5);
            }
            else
            {
                int w = (int)en.size() - 1 - i;
                for (int j = 0; j <= w; ++j)
                    p += en[i + j];

                for (int j = 1; j < 5 - w; ++j)
                    p += '0';
            }

            ans += mp2[p];
        }
        cout << ans << endl;
    }
    return 0;
}
