#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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

    char restore[32];
    for(int i=0; i<26; ++i)
        restore[i] = i + 'A';
    restore[26] = ' ';
    restore[27] = '.';
    restore[28] = ',';
    restore[29] = '-';
    restore[30] = '\'';
    restore[31] = '?';


    for(;;){
        string s;
        if(!getline(cin, s))
            return 0;

        int n = s.size();
        string s1;
        for(int i=0; i<n; ++i)
            s1 += code[s[i]];
        while(s1.size() % 5 != 0)
            s1 += '0';

        n = s1.size();
        string ret;
        for(int i=0; i<n; i+=5){
            int a = bitset<5>(s1.substr(i, 5)).to_ulong();
            ret += restore[a];
        }

        cout << ret << endl;
    }
}