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

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