//29
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

int main(){
  string ct=" ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  const char *en[]={"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"};
  for(string s;getline(cin,s);){
    string code;
    for(int i=0;i<s.size();i++){
      code+=en[ct.find(s[i])];
    }
    code+=string((code.size()+4)/5*5-code.size(),'0');
    for(int i=0;i<code.size()/5;i++){
      static const char *de="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
      cout<<de[strtol(code.substr(i*5,5).c_str(),0,2)];
    }
    cout<<endl;
  }
  return 0;
}