#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> Point;

int main()
{
	map<char, string> encode;
	encode[' '] = "101";
	encode['\''] = "000000";
	encode[','] = "000011";
	encode['-'] = "10010001";
	encode['.'] = "010001";
	encode['?'] = "000001";
	encode['A'] = "100101";
	encode['B'] = "10011010";
	encode['C'] = "0101";
	encode['D'] = "0001";
	encode['E'] = "110";
	encode['F'] = "01001";
	encode['G'] = "10011011";
	encode['H'] = "010000";
	encode['I'] = "0011";
	encode['J'] = "10011000";
	encode['K'] = "0110";
	encode['L'] = "00100";
	encode['M'] = "10011001";
	encode['N'] = "10011110";
	encode['O'] = "00101";
	encode['P'] = "111";
	encode['Q'] = "10011111";
	encode['R'] = "1000";
	encode['S'] = "00110";
	encode['T'] = "00111";
	encode['U'] = "10011100";
	encode['V'] = "10011101";
	encode['W'] = "000010";
	encode['X'] = "10010010";
	encode['Y'] = "10010011";
	encode['Z'] = "10010000";
	const char* decode = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";

	string str;
	while(getline(cin, str)){
		string secret;
		rep(i, str.size()){
			secret += encode[str[i]];
		}
		if(secret.size()%5 != 0)
			secret += string(5-secret.size()%5, '0');

		string answer;
		for(int i=0; i<int(secret.size()); i+=5){
			int n = 0;
			rep(j, 5) n += (1 << (4-j)) * (secret[i+j] - '0');
			answer += decode[n];
		}
		puts(answer.c_str());
	}
	return 0;
}