#include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
  map<char,string> t;
  t[' '] = "101";
  t['\''] = "000000";
  t[','] = "000011";
  t['-'] = "10010001";
  t['.'] = "010001";
  t['?'] = "000001";
  t['A'] = "100101";
  t['B'] = "10011010";
  t['C'] = "0101";
  t['D'] = "0001";
  t['E'] = "110";
  t['F'] = "01001";
  t['G'] = "10011011";
  t['H'] = "010000";
  t['I'] = "0111";
  t['J'] = "10011000";
  t['K'] = "0110";
  t['L'] = "00100";
  t['M'] = "10011001";
  t['N'] = "10011110";
  t['O'] = "00101";
  t['P'] = "111";
  t['Q'] = "10011111";
  t['R'] = "1000";
  t['S'] = "00110";
  t['T'] = "00111";
  t['U'] = "10011100";
  t['V'] = "10011101";
  t['W'] = "000010";
  t['X'] = "10010010";
  t['Y'] = "10010011";
  t['Z'] = "10010000";
  map<string,char> t2;
  t2["00000"] = 'A';
  t2["00001"] = 'B';
  t2["00010"] = 'C';
  t2["00011"] = 'D';
  t2["00100"] = 'E';
  t2["00101"] = 'F';
  t2["00110"] = 'G';
  t2["00111"] = 'H';
  t2["01000"] = 'I';
  t2["01001"] = 'J';
  t2["01010"] = 'K';
  t2["01011"] = 'L';
  t2["01100"] = 'M';
  t2["01101"] = 'N';
  t2["01110"] = 'O';
  t2["01111"] = 'P';
  t2["10000"] = 'Q';
  t2["10001"] = 'R';
  t2["10010"] = 'S';
  t2["10011"] = 'T';
  t2["10100"] = 'U';
  t2["10101"] = 'V';
  t2["10110"] = 'W';
  t2["10111"] = 'X';
  t2["11000"] = 'Y';
  t2["11001"] = 'Z';
  t2["11010"] = ' ';
  t2["11011"] = '.';
  t2["11100"] = ',';
  t2["11101"] = '-';
  t2["11110"] = '\'';
  t2["11111"] = '?';
  string s,x;
  getline(cin,s);
  x = "";
  for(int i=0; i<s.size(); i++){
    x+=t[s[i]];
  }
  for(;x.size()%5;) x+="0";
  for(int i=0; i<x.size(); i+=5){
    cout <<t2[x.substr(i,5)];
  }
  cout <<endl;
  return 0;
}