#include <iostream>
#include <vector>
using namespace std;

string h = "ABCDEFGHIJKLMNOPQRSTUVWXYZ ',-.?";
char d[36] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
char e[36][12] = {"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","101","000000","000011","10010001","010001","000001"};

char conv(string s){
    int ans = 0;
    string::iterator it = s.begin();
    for(int n = 0; n < 5; n++){
        if( it == s.end() ) continue;
        ans *= 2;
        ans += *it - '0';
        it++;
    }
    return d[ans];

}

int main(){
    string s;
    while( getline(cin, s) ){
        string c;
        c = string("");
        for(int i = 0; i < s.size(); i++){
            //cout << e[h.find(s[i])] << endl;
            c += e[h.find(s[i])];
        }
        c += string(4-(c.size()+4)%5, '0');
        for(int i = 0; i < c.size()/5; i++){
            cout << conv( c.substr(i*5, 5) );
        }
        cout << endl;
    }
    return 0;
}