//The Code A Doctor Loved
#include<bits/stdc++.h>
using namespace std;

string p(string s, string t){
  for(int i=0; i<t.length(); i++){
    if(s.length()%6==5)s+=' ';
    s+=t[i];
  }
  return s;
}

string into(string s){
  string t="";
  for(int i=0; i<s.length(); i++){
    if(s[i]==' ')t=p(t, "101");
    if(s[i]=='\'')t=p(t, "000000");
    if(s[i]==',')t=p(t,"000011");
    if(s[i]=='_')t=p(t,"10010001");
    if(s[i]=='.')t=p(t,"010001");
    if(s[i]=='?')t=p(t,"000001");
    if(s[i]=='A')t=p(t,"100101");
    if(s[i]=='B')t=p(t,"10011010");
    if(s[i]=='C')t=p(t,"0101");
    if(s[i]=='D')t=p(t,"0001");
    if(s[i]=='E')t=p(t,"110");
    if(s[i]=='F')t=p(t,"01001");
    if(s[i]=='G')t=p(t,"10011011");
    if(s[i]=='H')t=p(t,"010000");
    if(s[i]=='I')t=p(t,"0111");
    if(s[i]=='J')t=p(t,"10011000");
    if(s[i]=='K')t=p(t,"0110");
    if(s[i]=='L')t=p(t,"00100");
    if(s[i]=='M')t=p(t,"10011001");
    if(s[i]=='N')t=p(t,"10011110");
    if(s[i]=='O')t=p(t,"00101");
    if(s[i]=='P')t=p(t,"111");
    if(s[i]=='Q')t=p(t,"10011111");
    if(s[i]=='R')t=p(t,"1000");
    if(s[i]=='S')t=p(t,"00110");
    if(s[i]=='T')t=p(t,"00111");
    if(s[i]=='U')t=p(t,"10011100");
    if(s[i]=='V')t=p(t,"10011101");
    if(s[i]=='W')t=p(t,"000010");
    if(s[i]=='X')t=p(t,"10010010");
    if(s[i]=='Y')t=p(t,"10010011");
    if(s[i]=='Z')t=p(t,"10010000");
  }
  while(t.length()%6!=5)t+='0';
  stringstream ss(t);
  string ret="", tmp;
  while(getline(ss, tmp, ' ')){
    if(tmp=="00000")ret+='A';
    if(tmp=="00001")ret+='B';
    if(tmp=="00010")ret+='C';
    if(tmp=="00011")ret+='D';
    if(tmp=="00100")ret+='E';
    if(tmp=="00101")ret+='F';
    if(tmp=="00110")ret+='G';
    if(tmp=="00111")ret+='H';
    if(tmp=="01000")ret+='I';
    if(tmp=="01001")ret+='J';
    if(tmp=="01010")ret+='K';
    if(tmp=="01011")ret+='L';
    if(tmp=="01100")ret+='M';
    if(tmp=="01101")ret+='N';
    if(tmp=="01110")ret+='O';
    if(tmp=="01111")ret+='P';
    if(tmp=="10000")ret+='Q';
    if(tmp=="10001")ret+='R';
    if(tmp=="10010")ret+='S';
    if(tmp=="10011")ret+='T';
    if(tmp=="10100")ret+='U';
    if(tmp=="10101")ret+='V';
    if(tmp=="10110")ret+='W';
    if(tmp=="10111")ret+='X';
    if(tmp=="11000")ret+='Y';
    if(tmp=="11001")ret+='Z';
    if(tmp=="11010")ret+=' ';
    if(tmp=="11011")ret+='.';
    if(tmp=="11100")ret+=',';
    if(tmp=="11101")ret+='_';
    if(tmp=="11110")ret+='\'';
    if(tmp=="11111")ret+='?';
  }
  return ret;
}

int main(){
  string s;
  while(getline(cin, s)){
    cout<<into(s)<<endl;
  }
  return 0;
}