#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int INF=1e9;
const int MOD=100000;
int main(){
      map<char,string> s;
      s[' '] = "101";
      s['\''] = "000000";
      s[','] = "000011";
      s['-'] = "10010001";
      s['.'] = "010001";
      s['?'] = "000001";
      s['A'] = "100101";
      s['B'] = "10011010";
      s['C'] = "0101";
      s['D'] = "0001";
      s['E'] = "110";
      s['F'] = "01001";
      s['G'] = "10011011";
      s['H'] = "010000";
      s['I'] = "0111";
      s['J'] = "10011000";
      s['K'] = "0110";
      s['L'] = "00100";
      s['M'] = "10011001";
      s['N'] = "10011110";
      s['O'] = "00101";
      s['P'] = "111";
      s['Q'] = "10011111";
      s['R'] = "1000";
      s['S'] = "00110";
      s['T'] = "00111";
      s['U'] = "10011100";
      s['V'] = "10011101";
      s['W'] = "000010";
      s['X'] = "10010010";
      s['Y'] = "10010011";
      s['Z'] = "10010000";
      map<string,char> t;
      t["00000"] = 'A';
      t["00001"] = 'B';
      t["00010"] = 'C';
      t["00011"] = 'D';
      t["00100"] = 'E';
      t["00101"] = 'F';
      t["00110"] = 'G';
      t["00111"] = 'H';
      t["01000"] = 'I';
      t["01001"] = 'J';
      t["01010"] = 'K';
      t["01011"] = 'L';
      t["01100"] = 'M';
      t["01101"] = 'N';
      t["01110"] = 'O';
      t["01111"] = 'P';
      t["10000"] = 'Q';
      t["10001"] = 'R';
      t["10010"] = 'S';
      t["10011"] = 'T';
      t["10100"] = 'U';
      t["10101"] = 'V';
      t["10110"] = 'W';
      t["10111"] = 'X';
      t["11000"] = 'Y';
      t["11001"] = 'Z';
      t["11010"] = ' ';
      t["11011"] = '.';
      t["11100"] = ',';
      t["11101"] = '-';
      t["11110"] = '\'';
      t["11111"] = '?';
      string in;
      while(getline(cin,in)){
            string in1="",ans="";
            REP(i,in.size()){
                  in1+=s[in[i]];
            }
            while(in1.size()%5!=0)in1+='0';
            REP(i,in1.size()/5){
                  in.assign(in1,i*5,5);
                  ans+=t[in];
            }
            cout<<ans<<endl;
      }
}