#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(o) {cerr<<#o<<" "<<o<<endl;}
#define DUMPC(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	unordered_map<char, string> a;
	unordered_map<string, string> b;
	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";
	b["00000"] = "A";
	b["00001"] = "B";
	b["00010"] = "C";
	b["00011"] = "D";
	b["00100"] = "E";
	b["00101"] = "F";
	b["00110"] = "G";
	b["00111"] = "H";
	b["01000"] = "I";
	b["01001"] = "J";
	b["01010"] = "K";
	b["01011"] = "L";
	b["01100"] = "M";
	b["01101"] = "N";
	b["01110"] = "O";
	b["01111"] = "P";
	b["10000"] = "Q";
	b["10001"] = "R";
	b["10010"] = "S";
	b["10011"] = "T";
	b["10100"] = "U";
	b["10101"] = "V";
	b["10110"] = "W";
	b["10111"] = "X";
	b["11000"] = "Y";
	b["11001"] = "Z";
	b["11010"] = " ";
	b["11011"] = ".";
	b["11100"] = ",";
	b["11101"] = "-";
	b["11110"] = "'";
	b["11111"] = "?";

	string s; getline(cin, s);
	string t = "";
	REP(i, s.size()) t += a[s[i]];
	int c = (5 - t.size() % 5) % 5;
	REP(i, c)t += "0";
	string ans = "";
	for (int i = 0; i < t.size(); i += 5) {
		ans += b[t.substr(i, 5)];
	}
	cout << ans << endl;
	return 0;
}