#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#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 <numeric>
#include <list>
#include <iomanip>

using namespace std;

char s[] = " ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string t[] = {
"101",
"000000",
"000011",
"10010001",
"010001",
"000001",
"100101",
"10011010",
"0101",
"0001",
"110",
"01001",
"10011011",
"010000",
"0111",
"10011000",
"0110",
"00100",
"10011001",
"10011110",
"00101",
"111",
"10011111",
"1000",
"00110",
"00111",
"10011100",
"10011101",
"000010",
"10010010",
"10010011",
"10010000"};
char r[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";

int main()
{
	string a;
	while(getline(cin,a)){
		string out;
		for (int i = 0; i < (int)a.size(); i++)
			out.append(t[find(s,s+sizeof(s),a[i]) - s]);
		while(out.size() % 5 != 0)
			out.push_back('0');
		for (int i = 0; i < (int)out.size() / 5; i++){
			int x = 0;
			for (int j = 0; j < 5; j++)
				x = (x << 1) + (out[i*5+j] == '1');
			putchar(r[x]);
		}
		putchar('\n');
	}

	return 0;
}