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

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

int strbin2i (const string &s) {
    int out = 0;
    for (int i = 0, size = s.size() ; i < size ; ++i ) {
        out *= 2;
        out += ((int)s[i] == 49) ? 1 : 0;
    }
    return out;
}

void decode(const string code, string& str) {
    char res;
    int i = strbin2i(code);
    if (i < 26) {
        res = 'A' + i;
    } else {
        switch (i) {
        case 26: res = ' '; break;
        case 27: res = '.'; break;
        case 28: res = ','; break;
        case 29: res = '-'; break;
        case 30: res = '\''; break;
        case 31: res = '?'; break;
        }
    }
    str += res;
}

int main() {
    string input;
    while (getline(cin, input)) {
        string str;
        for (string::iterator it = input.begin(); it < input.end(); it++) {
            code(*it, str);
        }
        while ((int) str.length() % 5 == 0) {
            str += '0';
        }
        string output;
        while (str.length() > 0) {
            decode(str.substr(0, 5), output);
            str.erase(0, 5);
        }
        cout << output << endl;
    }
}