#include<iostream>
#include<string>
#include<map>
#include<algorithm>

using namespace std;

void MakeFirstList(map<char, string>&);
void MakeSecondList(map<string, char>&);

int main(){
  int i;
  string s, t, r, u;
  map<char, string> first;
  map<string, char> second;

  MakeFirstList(first);
  MakeSecondList(second);

  while(getline(cin, s)){
    for(i=0; i<s.size(); ++i)
      copy(first[s[i]].begin(), first[s[i]].end(), back_inserter(t));
    const string zero(5-t.size()%5, '0');
    copy(zero.begin(), zero.end(), back_inserter(t));

    string::iterator iter = t.begin();
    while(iter != t.end()){
      copy(iter, iter+5, back_inserter(r));
      u.insert(u.end(), second[r]);
      r.clear();
      iter += 5;
    }

    cout << u << endl;

    s.clear();
    t.clear();
    r.clear();
    u.clear();
  }

  return 0;
}

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

void MakeSecondList(map<string, char>& s){
  s["00000"] = 'A';
  s["00001"] = 'B';
  s["00010"] = 'C';
  s["00011"] = 'D';
  s["00100"] = 'E';
  s["00101"] = 'F';
  s["00110"] = 'G';
  s["00111"] = 'H';
  s["01000"] = 'I';
  s["01001"] = 'J';
  s["01010"] = 'K';
  s["01011"] = 'L';
  s["01100"] = 'M';
  s["01101"] = 'N';
  s["01110"] = 'O';
  s["01111"] = 'P';
  s["10000"] = 'Q';
  s["10001"] = 'R';
  s["10010"] = 'S';
  s["10011"] = 'T';
  s["10100"] = 'U';
  s["10101"] = 'V';
  s["10110"] = 'W';
  s["10111"] = 'X';
  s["11000"] = 'Y';
  s["11001"] = 'Z';
  s["11010"] = ' ';
  s["11011"] = '.';
  s["11100"] = ',';
  s["11101"] = '_';
  s["11110"] = '\'';
  s["11111"] = '?';
}