#include <string>
#include <iostream>

using namespace std;

int bitstrtoint(string str){
  int res = 0;
  for(int i = 0; i < str.size(); i++){
    res *= 2;
    res += str[i] == '1';
  }
  return res;
}

int main(){
  string str;
  while(getline(cin, str)){
    string numstr = "";
    for(int i = 0; i < str.size(); i++){
      switch((char)str[i]){
      case ' ':
        numstr += "101";
        break;
      case '\'':
        numstr += "000000";
        break;
      case ',':
        numstr += "000011";
        break;
      case '-':
        numstr += "10010001";
        break;
      case '.':
        numstr += "010001";
        break;
      case '?':
        numstr += "000001";
        break;
      case 'A':
        numstr += "100101";
        break;
      case 'B':
        numstr += "10011010";
        break;
      case 'C':
        numstr += "0101";
        break;
      case 'D':
        numstr += "0001";
        break;
      case 'E':
        numstr += "110";
        break;
      case 'F':
        numstr += "01001";
        break;
      case 'G':
        numstr += "10011011";
        break;
      case 'H':
        numstr += "010000";
        break;
      case 'I':
        numstr += "0111";
        break;
      case 'J':
        numstr += "10011000";
        break;
      case 'K':
        numstr += "0110";
        break;
      case 'L':
        numstr += "00100";
        break;
      case 'M':
        numstr += "10011001";
        break;
      case 'N':
        numstr += "10011110";
        break;
      case 'O':
        numstr += "00101";
        break;
      case 'P':
        numstr += "111";
        break;
      case 'Q':
        numstr += "10011111";
        break;
      case 'R':
        numstr += "1000";
        break;
      case 'S':
        numstr += "00110";
        break;
      case 'T':
        numstr += "00111";
        break;
      case 'U':
        numstr += "10011100";
        break;
      case 'V':
        numstr += "10011101";
        break;
      case 'W':
        numstr += "000010";
        break;
      case 'X':
        numstr += "10010010";
        break;
      case 'Y':
        numstr += "10010011";
        break;
      case 'Z':
        numstr += "10010000";
      }
    }
    str = "";
    for(int i = 0; i < numstr.size(); i += 5){
      int code = bitstrtoint(numstr.substr(i, 5));
      if(0 <= code && code < 26){
        str += (char)(code + 65);
      }
      else{
        switch(code){
        case 26:
          str += " ";
          break;
        case 27:
          str += ".";
          break;
        case 28:
          str += ",";
          break;
        case 29:
          str += "-";
          break;
        case 30:
          str += "\'";
          break;
        case 31:
          str += "?";
        }
      }
    }
    cout << str << "\n";
  }
  return 0;
}