#include <iostream>
using namespace std;

string code[256];
char decode[32];

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

  for(int i = 0; i < 26; i++){
    decode[i] = 'A' + i;
  }
  decode[26] = ' '; decode[27] = '.'; decode[28] = ','; decode[29] = '-';
  decode[30] = '\''; decode[31] = '?';
}

int main(void){
  init();
  string input;
  while(getline(cin, input)){
    string e = "";
    for(int i = 0; i < input.size(); i++){
      e += code[input[i]];
    }
    if(e.size() % 5 != 0){
      int pad = 5 - (e.size() % 5);
      for(int i = 0; i < pad; i++) e += "0";
    }
    for(int i = 0; i < e.size(); i += 5){
      int offset = ((int)e[i] - '0') * 16 + ((int)e[i+1] - '0') * 8 + ((int)e[i+2] - '0') * 4 + ((int)e[i+3] - '0') * 2 + ((int)e[i+4] - '0');
      cout << decode[offset];
    }
    cout << endl;
  }
  return 0;
}