#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iomanip>
#include <queue>
#include <sstream>
#include <climits>
#include <cmath>
#include <list>
#include <functional>
#include <map>
#include <stack>
using namespace std;
#define M_PI 3.141592
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define FORI(i,k,n) for(int i=k;i<(int)n;i++)
#define toRad 2.0*M_PI/360.0
#define inin(x) int x;cin>>x;
#define all(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" :"<<x<<endl;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define EPS 1e-12
#define pri_max 60000
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

/* 
bool memo[pri_max] = {};
vector<int> pri;
void calc()
{
	for (int i = 2; i < pri_max; i++)
	{
		if (memo[i] == false)
		{
			pri.push_back(i);
			for (int l = i; l < pri_max; l += i)
			{
				memo[l] = true;
			}
		}
	}
}*/
double len(pdd a, pdd b)
{
	return sqrt((b.first - a.first)*(b.first - a.first) + (b.second - a.second)*(b.second - a.second));
}

string en[] =
{
" 101",
"'000000",
",000011",
"-10010001",
".010001",
"?000001",
"A100101",
"B10011010",
"C0101",
"D0001",
"E110",
"F01001",
"G10011011",
"H010000",
"I0111",
"J10011000",
"K0110",
"L00100",
"M10011001",
"N10011110",
"O00101",
"P111",
"Q10011111",
"R1000",
"S00110",
"T00111",
"U10011100",
"V10011101",
"W000010",
"X10010010",
"Y10010011",
"Z10010000"
};
string de = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
int todec(string x)
{
	reverse(all(x));
	int ans = 0;
	for (int i = 0; i < x.size(); i++)
	{
		ans += (x[i] - '0')*pow(2, i);
	}
	return ans;
}

int main()
{
	string s;
	while (getline(cin, s))
	{
		string a, b;
		for (int l = 0; l < s.size(); l++)
		{
			for (int i = 0; i < 32; i++)
			{
				if (s[l] == en[i][0])
				{
					a += en[i].substr(1, en[i].size() - 1);
				}
			}
		}
		FOR(i, a.size() % 5)a += "0";
		for (int i = 0; i < a.size() / 5; i++)
		{
			b+=de[todec(a.substr(i * 5, 5))];
		}
		cout << b << endl;
	}
}