#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

map<char,string> m;
map<string,char> mm;

inline char i2c(int i) { return '0'+i; }

string i2bs(int a) {
  string ret;
  while (a > 0) {
    ret += i2c(a % 2);
    a /= 2;
  }
  reverse(ret.begin(), ret.end());
  while (ret.size() < 5) ret = '0' + ret;
  return ret;
}

void init() {
  const string s[] = {
    "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"
  };
  const char c[] = { ' ', '\'', ',', '-', '.', '?' };
  const char cc[] = { ' ', '.', ',', '-', '\'', '?' };
  const int sn = sizeof(s) / sizeof(string);
  const int cn = sizeof(c) / sizeof(char);
  rep(i,sn) {
    if(i<cn) m.insert(make_pair(c[i],s[i]));
    else m.insert(make_pair('A'+(i-cn),s[i]));

    if(i<26) mm.insert(make_pair(i2bs(i),'A'+i));
    else mm.insert(make_pair(i2bs(i),c[i-26]));
  }
}

int main() {
  init();
  string in;
  while(getline(cin,in)) {
    string tmp;
    rep(i,in.size()) tmp+=m[in[i]];
    while(tmp.size()%5!=0) tmp+='0';
    //cout << tmp << endl;
    string out;
    for(int i=0;i<tmp.size();i+=5) {
      out+=mm[tmp.substr(i,5)];
    }
    cout<<out<<endl;
  }
  return 0;
}