#include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999

int main(){
    string s,x;
    while(getline(cin,x)){
        s+=x;s+=" ";
    }
    s=s.substr(0,s.size()-1);
    string a="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
    string b[]={"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 c=" ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    string d[]={"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"};
    map<string,char> mpb;
    map<char,string> mpa;
    rep(i,a.size()){
        mpb[b[i]]=a[i];
    }
    rep(i,c.size()){
        mpa[c[i]]=d[i];
    }
    
    string str="";
    rep(i,s.size()){
        str+=mpa[s[i]];
    }
    int len=str.size();
    rep(i,5-(len%5))str+="0";
    
    string sx="";
    len=str.size();
    rep(i,len/5+1){
        sx+=mpb[str.substr(5*i,5)];
    }
    cout<<sx<<endl;
}