#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

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

    string s;
    while(getline(cin,s)) {
        int l = s.length();
        string temp;
        rep(i,0,l) temp += m[(char)s[i]];
        int l2 = temp.length();
        rep(i,0,5 - (l2%5 == 0 ? 5 : l2%5)) temp += "0";

        l2 = temp.length();
        string ans;
        int ans_i;
        rep(i,0,l2 / 5) {
            ans_i = 0;
            string ans_s = temp.substr(i*5, 5);
            rep(j,0,5) {
                ans_i += ((int)((char)ans_s[j]) - 48) << (4-j);
            }
            if(ans_i <= 25) ans += (char)((char)ans_i + 'A');
            else {
                switch(ans_i){
                    case 26:
                        ans += " "; break;
                    case 27:
                        ans += "."; break;
                    case 28:
                        ans += ","; break;
                    case 29:
                        ans += "-"; break;
                    case 30:
                        ans += "\'"; break;
                    case 31:
                        ans += "?"; break;
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}