#include<iostream>
#include<map>

using namespace std;

string in;
map<char,string> M;
map<string,char> M_2;

void solve(string in){
  string out = "";

  for(int i = 0; i < in.length(); i++)
    out += M[in[i]];

  while(out.length()%5) out+="0";

  string ans = "";
  for(int i = 0; i < out.length(); i+=5){
    string now = "";
    for(int j = 0; j < 5; j++)
      now += out[i+j];
    ans += M_2[now];
  }
  cout << ans << endl;
}

string to_b(int num){
  string out = "";
  for(int i = 4; i >= 0; i--){
    if(num >= (1<<i)){
      out += "1";
      num -= (1<<i);
    }else out += "0";
  }

  return out;
}

void make(){
  M[' '] = "101";
  M['\''] = "000000";
  M[','] = "000011";
  M['-'] = "10010001";
  M['.'] = "010001";
  M['?'] = "000001";
  M['A'] = "100101";
  M['B'] = "10011010";
  M['C'] = "0101";
  M['D'] = "0001";
  M['E'] = "110";
  M['F'] = "01001";
  M['G'] = "10011011";
  M['H'] = "010000";
  M['I'] = "0111";
  M['J'] = "10011000";
  M['K'] = "0110";
  M['L'] = "00100";
  M['M'] = "10011001";
  M['N'] = "10011110";
  M['O'] = "00101";
  M['P'] = "111";
  M['Q'] = "10011111";
  M['R'] = "1000";
  M['S'] = "00110";
  M['T'] = "00111";
  M['U'] = "10011100";
  M['V'] = "10011101";
  M['W'] = "000010";
  M['X'] = "10010010";
  M['Y'] = "10010011";
  M['Z'] = "10010000";

  for(char c = 'A'; c <= 'Z'; c++)
    M_2[to_b((int)(c-'A'))] = c;
 
  M_2["11010"] = ' ';
  M_2["11011"] = '.';
  M_2["11100"] = ',';
  M_2["11101"] = '-';
  M_2["11110"] = '\'';
  M_2["11111"] = '?';
  
}


int main(){
  make();
  while(getline(cin,in)) solve(in);
  return 0;
}