#include <bits/stdc++.h>

using namespace std;

string a[32] = {"101", "000000", "000011", "10010001", "010001", "000001", "100101", "10011010", "0101", "0001", "110", "01001", "10011011", "010000", "0111", "10011000", "0110", "00100", "10011001", "10011110", "00101", "111", "10011111", "1000", "00110", "00111", "10011100", "10011101", "000010", "10010010", "10010011", "10010000"};
string b = " ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string c[32] = {"00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111", "01000", "01001", "01010", "01011", "01100", "01101", "01110", "01111", "10000", "10001", "10010", "10011", "10100", "10101", "10110", "10111", "11000", "11001", "11010", "11011", "11100", "11101", "11110", "11111"};
string d = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";

int main(){
    string s;
    map<string, string> p, q;
    for(int i=0; i< 32; i++){p[b.substr(i, 1)] = a[i]; q[c[i]] = d.substr(i, 1);}
    while(getline(cin, s)){
        string t, ret;
        for(int i=0; i< s.size(); i++) t += p[s.substr(i, 1)];
        int diff = 5-t.size()%5;
        if(diff != 5)for(int i=0; i < diff; i++) t+="0";
        for(int i=0; i < t.size(); i+=5) ret += q[t.substr(i, 5)];
        cout << ret << endl;
    }
}