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

map <char,string> t;
void make_table(){
  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'] ="1001100";
  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";
}
char ch_table[]={' ','.',',','-','\'','?'};

char s2ch(string str){
  int num=0;
  for(int i=0;i<5;i++){
    num*=2;
    num+=str[i]-'0';
  }
  if(num<=25)return 'A'+num;
  return ch_table[num-26];
}

int main(){
  string str,A;
  make_table();
  while(getline(cin,str)){
    A="";
    for(int i=0;i<(int)str.size();i++){
      A+=t[str[i]];
    }
    
    while(A.size()%5!=0)A+="0";
    
    for(int i=0;i<(int)A.size();i+=5){
      //cout<<A.substr(i,5)<<" ";
      cout<<s2ch(A.substr(i,5));
    }
    cout<<endl;
  }
  return 0;
}