#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
string tonum(string &str, int i,map<char,string> &data){
  if(i==str.size()) return "";
  return data[str[i]] + tonum(str,i+1,data);
}
int main(void){
  map<char,string> data;
  data[' '] = "101";
  data['\''] = "000000";
  data[','] = "000011";
  data['-'] = "1001001";
  data['.'] = "010001";
  data['?'] = "000001";
  data['A'] = "100101";
  data['B'] = "10011010";
  data['C'] = "0101";
  data['D'] = "0001";
  data['E'] = "110";
  data['F'] = "01001";
  data['G'] = "10011011";
  data['H'] = "010000";
  data['I'] = "0111";
  data['J'] = "10011000";
  data['K'] = "0100";
  data['L'] = "00100";
  data['M'] = "10011001";
  data['N'] = "10011110";
  data['O'] = "00101";
  data['P'] = "111";
  data['Q'] = "10011111";
  data['R'] = "1000";
  data['S'] = "00110";
  data['T'] = "00111";
  data['U'] = "10011100";
  data['V'] = "10011101";
  data['W'] = "000010";
  data['X'] = "10010010";
  data['Y'] = "10010011";
  data['Z'] = "10010000";
  string input;
  while(getline(cin,input)){
    string code = tonum(input,0,data);
    for(int i=0; i<code.size(); i+=5){
      string five = code.substr(i,5);
      if(five.size()<5){
        while(five.size()!=5) five.push_back('0');
      }
      int num5 = 0;
      REP(i,5) num5+=(five[i]-'0')*pow(2,4-i);
      if(num5<26){
        cout<<(char)('A'+num5);
      }else{
        if(num5==26) cout<<' ';
        if(num5==27) cout<<'.';
        if(num5==28) cout<<',';
        if(num5==29) cout<<'-';
        if(num5==30) cout<<'\'';
        if(num5==31) cout<<'?';
      }
    }
    cout<<endl;
  }
  return 0;
}