#include <iostream>
#include <string>

using namespace std;

void solve()
{
	string str;
	while(getline(cin, str))
	{
		int n = str.size();
		string temp;
		for(int i = 0; i < n; ++i)
		{
			switch(str[i])
			{
				case ' ':temp += "101";		break;
				case '\'':temp += "000000";	break;
				case ',':temp += "000011";	break;
				case '-':temp += "10010001";break;
				case '.':temp += "010001";	break;
				case '?':temp += "000001";	break;
				case 'A':temp += "100101";	break;
				case 'B':temp += "10011010";break;
				case 'C':temp += "0101";	break;
				case 'D':temp += "0001";	break;
				case 'E':temp += "110";		break;
				case 'F':temp += "01001";	break;
				case 'G':temp += "10011011";break;
				case 'H':temp += "010000";	break;
				case 'I':temp += "0111";	break;
				case 'J':temp += "10011000";break;
				case 'K':temp += "0110";	break;
				case 'L':temp += "00100";	break;
				case 'M':temp += "10011001";break;
				case 'N':temp += "10011110";break;
				case 'O':temp += "00101";	break;
				case 'P':temp += "111";		break;
				case 'Q':temp += "10011111";break;
				case 'R':temp += "1000";	break;
				case 'S':temp += "00110";	break;
				case 'T':temp += "00111";	break;
				case 'U':temp += "10011100";break;
				case 'V':temp += "10011101";break;
				case 'W':temp += "000010";	break;
				case 'X':temp += "10010010";break;
				case 'Y':temp += "10010011";break;
				case 'Z':temp += "10010000";break;
			}
		}
		if(temp.size() % 5)
		{
			while(temp.size() % 5 != 0)
			{
				temp += '0';
			}
		}
		string Ans;
		n = temp.size();
		int count = 0;
		string s;
		for(int i = 0; i < n; ++i)
		{
			if(count == 5)
			{
				if(s == "00000")Ans += 'A';
				else if(s == "00001")Ans += 'B';
				else if(s == "00010")Ans += 'C';
				else if(s == "00011")Ans += 'D';
				else if(s == "00100")Ans += 'E';
				else if(s == "00101")Ans += 'F';
				else if(s == "00110")Ans += 'G';
				else if(s == "00111")Ans += 'H';
				else if(s == "01000")Ans += 'I';
				else if(s == "01001")Ans += 'J';
				else if(s == "01010")Ans += 'K';
				else if(s == "01011")Ans += 'L';
				else if(s == "01100")Ans += 'M';
				else if(s == "01101")Ans += 'N';
				else if(s == "01110")Ans += 'O';
				else if(s == "01111")Ans += 'P';
				else if(s == "10000")Ans += 'Q';
				else if(s == "10001")Ans += 'R';
				else if(s == "10010")Ans += 'S';
				else if(s == "10011")Ans += 'T';
				else if(s == "10100")Ans += 'U';
				else if(s == "10101")Ans += 'V';
				else if(s == "10110")Ans += 'W';
				else if(s == "10111")Ans += 'X';
				else if(s == "11000")Ans += 'Y';
				else if(s == "11001")Ans += 'Z';
				else if(s == "11010")Ans += ' ';
				else if(s == "11011")Ans += '.';
				else if(s == "11100")Ans += ',';
				else if(s == "11101")Ans += '-';
				else if(s == "11110")Ans += '\'';
				else if(s == "11111")Ans += '?';
				count = 0;
				s.clear();
			}
			s += temp[i];
			++count;
		}
		if(s == "00000")Ans += 'A';
		else if(s == "00001")Ans += 'B';
		else if(s == "00010")Ans += 'C';
		else if(s == "00011")Ans += 'D';
		else if(s == "00100")Ans += 'E';
		else if(s == "00101")Ans += 'F';
		else if(s == "00110")Ans += 'G';
		else if(s == "00111")Ans += 'H';
		else if(s == "01000")Ans += 'I';
		else if(s == "01001")Ans += 'J';
		else if(s == "01010")Ans += 'K';
		else if(s == "01011")Ans += 'L';
		else if(s == "01100")Ans += 'M';
		else if(s == "01101")Ans += 'N';
		else if(s == "01110")Ans += 'O';
		else if(s == "01111")Ans += 'P';
		else if(s == "10000")Ans += 'Q';
		else if(s == "10001")Ans += 'R';
		else if(s == "10010")Ans += 'S';
		else if(s == "10011")Ans += 'T';
		else if(s == "10100")Ans += 'U';
		else if(s == "10101")Ans += 'V';
		else if(s == "10110")Ans += 'W';
		else if(s == "10111")Ans += 'X';
		else if(s == "11000")Ans += 'Y';
		else if(s == "11001")Ans += 'Z';
		else if(s == "11010")Ans += ' ';
		else if(s == "11011")Ans += '.';
		else if(s == "11100")Ans += ',';
		else if(s == "11101")Ans += '-';
		else if(s == "11110")Ans += '\'';
		else if(s == "11111")Ans += '?';
		cout << Ans << endl;
	}
}

int main()
{
	solve();
	return(0);
}