#include <iostream>
#include <map>

using namespace std;

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

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

void init2(){
  n["00000"] = 'A';
  n["00001"] = 'B';
  n["00010"] = 'C';
  n["00011"] = 'D';
  n["00100"] = 'E';
  n["00101"] = 'F';
  n["00110"] = 'G';
  n["00111"] = 'H';
  n["01000"] = 'I';
  n["01001"] = 'J';
  n["01010"] = 'K';
  n["01011"] = 'L';
  n["01100"] = 'M';
  n["01101"] = 'N';
  n["01110"] = 'O';
  n["01111"] = 'P';
  n["10000"] = 'Q';
  n["10001"] = 'R';
  n["10010"] = 'S';
  n["10011"] = 'T';
  n["10100"] = 'U';
  n["10101"] = 'V';
  n["10110"] = 'W';
  n["10111"] = 'X';
  n["11000"] = 'Y';
  n["11001"] = 'Z';
  n["11010"] = ' ';
  n["11011"] = '.';
  n["11100"] = ',';
  n["11101"] = '-';
  n["11110"] = '\'';
  n["11111"] = '?';
}

int main(){
  string str;

  init1();
  init2();

  while(getline(cin,str)){
    string s = "";
    for(int i = 0 ; i < (int)str.size() ; i++){
      s += m[str[i]];
    }
    
    if((int)s.size() % 5){
      for(int i = 0 ; i < (int)s.size() % 5 ; i++){
	s += '0';
      }
    }
    
    string ans = "";
    for(int i = 0 ; i < (int)s.size() ; i+=5){
      ans += n[s.substr(i,5)];
    }
    
    cout << ans << endl;
  }
  
  return 0;
}