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

map<char, string> m1;
char m2[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-\'?";

string strToBitSeq(const string& str)
{
    string result;
    for(int i = 0; i < str.size(); ++i) result += m1[str[i]];
    if(result.size() % 5 != 0) result.append(5 - result.size() % 5, '0');
    return result;
}

string bitSeqToStr(const string& str)
{
    string result;
    for(int i = 0; i < str.size(); i += 5){
        result += m2[strtol(str.substr(i, 5).c_str(), NULL, 2)];
    }
    return result;
}

int main()
{
    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";
    
    string str;
    while(getline(cin, str)){
        cout << bitSeqToStr(strToBitSeq(str)) << endl;
    }
}