#include <iostream>
#include <cstdio>
using namespace std;
string str[] ={"101","000000",  "000011",  "10010001",  "010001",  "000001",  "100101",  "10011010",  "0101", "0001",
	       "110",  "01001",  "10011011",  "010000",  "0111",  "10011000",  "0110",  "00100",  "10011001",
	       "10011110",  "00101",  "111",  "10011111",  "1000",  "00110",  "00111",  "10011100",  "10011101",
	       "000010","10010010",  "10010011", "10010000"};
string str2[] = {" ","'",",","-",".","?","A","B","C","D","E","F","G","H",
		 "I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
string s3[] = {"11010","11011","11100","11101", "11110","11111",
	       "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"};
int main(){
  string str3 = "";
  while(getline(cin,str3)){

  string s4 = "";


  for(int i = 0 ; i < str3.size() ; i++){

    if(33 <= str3[i] - ' ' && str3[i] - ' ' <=58){
      s4+=str[str3[i] - ' ' - 27];
    }else if(str3[i] - ' ' == 7 ){
      s4+=str[1];
    }else if(12 <= str3[i] - ' '&& str3[i] - ' ' <= 14){
      s4+=str[str3[i] - ' ' - 10];
    }else if(str3[i] - ' ' == 31){
      s4+=str[5];
    }else s4 += str[0];
  }

  while(s4.size()%5 != 0){
    s4 += '0';
  }

  string s5 = "";
  swap(str2[1],str2[4]);
  for(int i = 0 ; i < s4.size() ; i += 5){
    string s = "";
    for(int k = i ; k < i+5 ; k++){
      s+=s4[k];
    }

    for(int j = 0 ; j < 32 ; j++ ){
      if(s == s3[j])s5+=str2[j];
    }
  }
  cout << s5 << endl;
  swap(str2[1],str2[4]);
  cin.clear();
  }
}