#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<climits>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
#define P pair<int, int>
const int INF = INT_MAX / 2;

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

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

    string inp;
    while(getline(cin, inp)){
        string tmp = "";
        REP(i, inp.length()) tmp += f[inp[i]];
        while(tmp.size() % 5 != 0) tmp += '0';
        string ans = "";
        for(int i = 0; i < tmp.size(); i += 5) ans += s[tmp.substr(i, 5)];
        cout <<ans <<endl;
    }
    return 0;
}