#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#define pb push_back


map<char,string> dic;

main(){


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

    for(int i=0;i<code.size();){
      string dec;
      rep(j,5)dec+=code[i+j];
      i+=5;
      
      int by=0;
      //cout<<dec<<endl;
      for(int j=0;j<5;j++){
        by=by*2+dec[j]-'0';
      }
      if(by<26)cout<<char(by+'A');
      else{
        switch(by){
        case 26:
          cout<<' ';
          break;
        case 27:
          cout<<'.';
          break;
        case 28:
          cout<<',';
          break;
        case 29:
          cout<<'-';
          break;
        case 30:
          cout<<'\'';
          break;
        case 31:
          cout<<'?';
          break;
        }
      }
    }
    cout<<endl;
  }
}