#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    string s;
    map<char,string> ma1;
    ma1[' '] = "101";
    ma1['\''] = "000000";
    ma1[','] = "000011";
    ma1['-'] = "10010001";
    ma1['.'] = "010001";
    ma1['?'] = "000001";
    ma1['A'] = "100101";
    ma1['B'] = "10011010";
    ma1['C'] = "0101";
    ma1['D'] = "0001";
    ma1['E'] = "110";
    ma1['F'] = "01001";
    ma1['G'] = "10011011";
    ma1['H'] = "010000";
    ma1['I'] = "0111";
    ma1['J'] = "10011000";
    ma1['K'] = "0110";
    ma1['L'] = "00100";

    ma1['M'] = "10011001";
    ma1['N'] = "10011110";
    ma1['O'] = "00101";
    ma1['P'] = "111";
    ma1['Q'] = "10011111";
    ma1['R'] = "1000";
    ma1['S'] = "00110";
    ma1['T'] = "00111";
    ma1['U'] = "10011100";
    ma1['V'] = "10011101";
    ma1['W'] = "000010";
    ma1['X'] = "10010010";
    ma1['Y'] = "10010011";
    ma1['Z'] = "10010000";
    map<string,string>ma2;
    ma2["00000"] = "A";
    ma2["00001"] = "B";
    ma2["00010"] = "C";
    ma2["00011"] = "D";
    ma2["00100"] = "E";
    ma2["00101"] = "F";
    ma2["00110"] = "G";
    ma2["00111"] = "H";
    ma2["01000"] = "I";
    ma2["01001"] = "J";
    ma2["01010"] = "K";
    ma2["01011"] = "L";
    ma2["01100"] = "M";
    ma2["01101"] = "N";
    ma2["01110"] = "O";
    ma2["01111"] = "P";
    ma2["10000"] = "Q";
    ma2["10001"] = "R";
    ma2["10010"] = "S";
    ma2["10011"] = "T";
    ma2["10100"] = "U";
    ma2["10101"] = "V";
    ma2["10110"] = "W";
    ma2["10111"] = "X";
    ma2["11000"] = "Y";
    ma2["11001"] = "Z";
    ma2["11010"] = " ";
    ma2["11011"] = ".";
    ma2["11100"] = ",";
    ma2["11101"] = "-";
    ma2["11110"] = "'";
    ma2["11111"] = "?";
    while(getline(cin,s)){
        int n = s.size();
        string t = "";
        rep(i,n)t += ma1[s[i]];
        while(t.size() % 5)t += "0";
        rep(i,t.size()/5){
            cout << ma2[t.substr(i*5,5)];
        }
        cout << endl;
    }
}

