#include<bits/stdc++.h>
using namespace std;


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


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


string solve(string s){
  string tmp = "";
  for(int i=0;i<s.size();i++){
    tmp += l1[s[i]];
  }
  while(tmp.size()%5!=0){
    tmp += '0';
  }
  
  string res = "";
  while(tmp.size()!=0){
    res += l2[tmp.substr(0,5)];
    tmp = tmp.substr(5);
  }

  return res;
}


int main(){
  init();
  string s;
  while(getline(cin,s)){
    cout<<solve(s)<<endl;
  }
}