//0088
//題意：暗号表を用いて暗号化し、複合表を用いて複合化するらしい
//
//入力：１行の文字列(データセット)
//制約：文字数は1~100
//出力：暗号文
//解決策：がんばる
//タイム：

#include <bits/stdc++.h>
using namespace std;
map<char, string> enc;
char decTable[] = {'A','B','C','D','E','F','G','H','I','J','K',
    'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ', '.',',','-', '\'', '?'}; //複合表

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

vector<string> encode(string text) {
    string tmp = "";
    vector<string> res;
    for(int r = 0; r < text.length(); r++) { //とりあえずばーっと連結
        tmp += enc[text[r]];
    }
    for(int r = 0; r + 5 < tmp.length(); r+=5) { //区切る
        res.push_back(tmp.substr(r, 5));
    }
    
    //0を付加
    int ex = tmp.size() % 5;
    if(ex != 0) {
        string edge = tmp.substr(tmp.length() - ex, ex);
        for(int r = 0; r < 5 - ex; r++) {
            edge += "0";
        }
        res.push_back(edge);
    }
    
    for(int r = 0; r < res.size(); r++) {
        
    }
    
    return(res);
}

int string_toi(string bin) {
    int base = 2, weight = 0;
    int res = 0;
    for(int r = (int)bin.length() - 1; r >= 0; r--) {
        if(bin[r] == '1') res += pow(base, weight);
        weight++;
    }
    return(res);
}

void solve(string input) {
    vector<string> ans = encode(input);
    for(int r = 0; r < ans.size(); r++) {
        int num = string_toi(ans[r]);
        putchar(decTable[num]);
    }
    putchar('\n');
}


int main(void) {
    init();
    string input;
    while(getline(cin, input)) {
        solve(input);
    }
    return(0);
}