#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999;
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

double distanceAB(double xa, double ya, double xb, double yb);

/*
class Target
{
public:
	vector <string> draw(int n)
	{

	}
};
*/



int main()
{
	string str;
	map<char, string> tbl;
	
	  tbl[' '] = "101";
	  tbl['\''] = "000000";
	  tbl[','] = "000011";
	  tbl['-'] = "10010001";
	  tbl['.'] = "010001";
	  tbl['?'] = "000001";
	  tbl['A'] = "100101";
	  tbl['B'] = "10011010";
	  tbl['C'] = "0101";
	  tbl['D'] = "0001";
	  tbl['E'] = "110";
	  tbl['F'] = "01001";
	  tbl['G'] = "10011011";
	  tbl['H'] = "010000";
	  tbl['I'] = "0111";
	  tbl['J'] = "10011000";
	  tbl['K'] = "0110";
	  tbl['L'] = "00100";
	  tbl['M'] = "10011001";
	  tbl['N'] = "10011110";
	  tbl['O'] = "00101";
	  tbl['P'] = "111";
	  tbl['Q'] = "10011111";
	  tbl['R'] = "1000";
	  tbl['S'] = "00110";
	  tbl['T'] = "00111";
	  tbl['U'] = "10011100";
	  tbl['V'] = "10011101";
	  tbl['W'] = "000010";
	  tbl['X'] = "10010010";
	  tbl['Y'] = "10010011";
	  tbl['Z'] = "10010000";
	
	map<string, char> tbl2;
	
	  tbl2["00000"] = 'A';
	  tbl2["00001"] = 'B';
	  tbl2["00010"] = 'C';
	  tbl2["00011"] = 'D';
	  tbl2["00100"] = 'E';
	  tbl2["00101"] = 'F';
	  tbl2["00110"] = 'G';
	  tbl2["00111"] = 'H';
	  tbl2["01000"] = 'I';
	  tbl2["01001"] = 'J';
	  tbl2["01010"] = 'K';
	  tbl2["01011"] = 'L';
	  tbl2["01100"] = 'M';
	  tbl2["01101"] = 'N';
	  tbl2["01110"] = 'O';
	  tbl2["01111"] = 'P';
	  tbl2["10000"] = 'Q';
	  tbl2["10001"] = 'R';
	  tbl2["10010"] = 'S';
	  tbl2["10011"] = 'T';
	  tbl2["10100"] = 'U';
	  tbl2["10101"] = 'V';
	  tbl2["10110"] = 'W';
	  tbl2["10111"] = 'X';
	  tbl2["11000"] = 'Y';
	  tbl2["11001"] = 'Z';
	  tbl2["11010"] = ' ';
	  tbl2["11011"] = '.';
	  tbl2["11100"] = ',';
	  tbl2["11101"] = '-';
	  tbl2["11110"] = '\'';
	  tbl2["11111"] = '?';
	
	while (getline(cin, str))
	{
		string code = "";
		string res = "";
		
		REP(str.length()) code += tbl[str[i]];
		int len = code.length();
		REP(5 - len % 5) code += "0";
		
		while (code.length() > 0)
		{
			string temp = code.substr(0, 5);
			res += tbl2[temp];
			code = code.substr(5);
		}
		
		cout << res << endl;
	}
	
	return 0;
}



double distanceAB(double xa, double ya, double xb, double yb)
{
	return sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya));
}