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

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

string decode(string s){
  string res;
  for(int i=0;i<(int)s.size();i+=5){
    int tmp=0,k=1;
    for(int j=4;j>=0;j--){
      tmp += (s[i+j] - '0') * k;
      k *= 2;
    }

    if(tmp <26)res.push_back('A'+tmp);
    if(tmp == 26)res.push_back(' ');
    if(tmp == 27)res.push_back('.');
    if(tmp == 28)res.push_back(',');
    if(tmp == 29)res.push_back('-');
    if(tmp == 30)res.push_back('\'');
    if(tmp == 31)res.push_back('?');
  }
  return res;
}

int main(){
  char str[10000];

  while(fgets(str,10000,stdin)!=NULL){
    int pos = 0;
    string c;
    while(str[pos]!='\n')c += code(str[pos++]);

    while((int)c.size()%5)c.push_back('0');

    cout << decode(c) << endl;
  }
}