#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }


string str;

map<char, string> ma;
map<string, char> ma2;

string IN[26] = {
    "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"};

int main() {
    ma[' '] = "101";
    ma[39] = "000000";
    ma[','] = "000011";
    ma['-'] = "10010001";
    ma['.'] = "010001";
    ma['?'] = "000001";
    for (int i = 0; i < 26; ++i) ma['A' + i] = IN[i];
    
    for (int bit = 0; bit < 26; ++bit) {
        string add = "";
        for (int i = 0; i < 5; ++i) {
            if (bit & (1<<i)) add += "1";
            else add += "0";
        }
        reverse(ALL(add));
        ma2[add] = 'A' + bit;
    }
    ma2["11010"] = ' ';
    ma2["11011"] = '.';
    ma2["11100"] = ',';
    ma2["11101"] = '-';
    ma2["11110"] = 39;
    ma2["11111"] = '?';
    
    //COUT(ma); COUT(ma2);
    
    while ( getline(cin, str) ) {
        string tmp = "";
        for (int i = 0; i < str.size(); ++i) tmp += ma[str[i]];
        
        string res = "";
        while (tmp.size() % 5 != 0) tmp += "0";
        for (int i = 0; i < tmp.size(); i += 5) {
            string sub = tmp.substr(i, 5);
            res += ma2[sub];
        }
        
        cout << res << endl;
    }
    
    return 0;
}
