#include <cstdio>
#include <string>
using namespace std;

const char w[6] = {' ', '\'', ',', '-', '.', '?'};
const char v[6] = {' ', '.', ',', '-', '\'', '?'};
const char *enc1[6] = {"101", "000000", "000011", "10010001", "010001", "000001"};
const char *enc2[26] = {"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"};

void decode(string &buf) {
  int t;
  t = 0;
  for (int i=0; i<5; i++) {
    t <<= 1;
    t += buf[i] - '0';
  }
  if (t < 26) printf("%c", 'A'+t);
  else printf("%c", v[t-26]);
  buf = buf.substr(5);
}

int main() {
  int t;
  char c;
  string buf;

  while ((c = getchar()) != EOF) {
    if (c>='A' && c<='Z') {
      buf += enc2[c-'A'];
    } else {
      for (int i=0; i<6; i++) {
        if (c == w[i]) {
          buf += enc1[i];
          break;
        }
      }
    }
    while (buf.length() >= 5) decode(buf);
    if (c=='\n') {
      t = buf.length();
      if (t && t < 5) {
        for (; t<5; ++t) {
          buf += "0";
        }
        decode(buf);
      }
      printf("\n");
    }
  }

  return 0;
}