#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

string a[256];

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