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

int main(){
  map<char,string> e;
  e[' ']="101";
  e['\'']="000000";
  e[',']="000011";
  e['-']="10010001";
  e['.']="010001";
  e['?']="000001";
  e['A']="100101";e['B']="10011010";e['C']="0101";
  e['D']="0001";e['E']="110";e['F']="01001";
  e['G']="10011011";e['H']="010000";e['I']="0111";
  e['J']="10011000";e['K']="0110";e['L']="00100";
  e['M']="10011001";e['N']="10011110";e['O']="00101";
  e['P']="111";e['Q']="10011111";e['R']="1000";
  e['S']="00110";e['T']="00111";e['U']="10011100";
  e['V']="10011101";e['W']="000010";e['X']="10010010";
  e['Y']="10010011";e['Z']="10010000";
  string s,t,a;
  char d[32];
  for(int i=0;i<26;++i) d[i]=i+'A';
  d[26]=' ';d[27]='.';d[28]=',';d[29]='-';d[30]='\'';d[31]='?';
  while(getline(cin,s)){
    t="";a="";
    for(string::iterator it=s.begin();it!=s.end();++it) t+=e[*it];
    if(t.size()%5){
      for(int i=t.size()-t.size()/5*5;i<5;++i) t+='0';
    }
    for(int i=0;i<t.size()/5*5;i+=5) a+=d[strtol(t.substr(i,5).c_str(),NULL,2)];
    cout<<a<<endl;
  }
  return 0;
}