#include <iostream>
#include <sstream>

using namespace std;

string encode1(char c) {
  switch (c) {
  case ' ': return "101";
  case '\'': return "000000";
  case ',': return "000011";
  case '-': return "10010001";
  case '.': return "010001";
  case '?': return "000001";
  case 'A': return "100101";
  case 'B': return "10011010";
  case 'C': return "0101";
  case 'D': return "0001";
  case 'E': return "110";
  case 'F': return "01001";
  case 'G': return "10011011";
  case 'H': return "010000";
  case 'I': return "0111";
  case 'J': return "10011000";
  case 'K': return "0110";
  case 'L': return "00100";
  case 'M': return "10011001";
  case 'N': return "10011110";
  case 'O': return "00101";
  case 'P': return "111";
  case 'Q': return "10011111";
  case 'R': return "1000";
  case 'S': return "00110";
  case 'T': return "00111";
  case 'U': return "10011100";
  case 'V': return "10011101";
  case 'W': return "000010";
  case 'X': return "10010010";
  case 'Y': return "10010011";
  case 'Z': return "10010000";
  }
  return "";
}

char encode2(string str) {
  int num = 0;
  int b = 1;
  for (int i = 0; i < 5; i++) {
    num += (str[4-i] == '0') ? 0 : b;
    b *= 2;
  }
  if (num <= 26) {
    return 'A' + num;
  }
  if (num == 27) return ' ';
  else if (num == 28) return '.';
  else if (num == 29) return ',';
  else if (num == 30) return '-';
  else if (num == 31) return '\'';
  else return '?';
}

int main() {
  string str;
  while (getline(cin, str)) {
    string result = "";
    for (unsigned int i = 0; i < str.size(); i++) {
      result += encode1(str[i]);
    }
    while (result.size() % 5) result += '0';
    string ans = "";
    for (unsigned int i = 0; i < result.size(); i += 5) {
      ans += encode2(result.substr(i, 5));
    }
    cout << ans << endl;
  }

  return 0;
}