#include <string>
#include <iostream>
using namespace std;
string s;
int main() {
	while(s = "", getline(cin, s)) {
		string t;
		for(int i = 0; i < s.size(); i++) {
			switch(s[i]) {
				case 'A': t += "100101"; break;
				case 'B': t += "10011010"; break;
				case 'C': t += "0101"; break;
				case 'D': t += "0001"; break;
				case 'E': t += "110"; break;
				case 'F': t += "01001"; break;
				case 'G': t += "10011011"; break;
				case 'H': t += "010000"; break;
				case 'I': t += "0111"; break;
				case 'J': t += "10011000"; break;
				case 'K': t += "0110"; break;
				case 'L': t += "00100"; break;
				case 'M': t += "10011001"; break;
				case 'N': t += "10011110"; break;
				case 'O': t += "00101"; break;
				case 'P': t += "111"; break;
				case 'Q': t += "10011111"; break;
				case 'R': t += "1000"; break;
				case 'S': t += "00110"; break;
				case 'T': t += "00111"; break;
				case 'U': t += "10011100"; break;
				case 'V': t += "10011101"; break;
				case 'W': t += "000010"; break;
				case 'X': t += "10010010"; break;
				case 'Y': t += "10010011"; break;
				case 'Z': t += "10010000"; break;
				case ' ': t += "101"; break;
				case '\'': t += "000000"; break;
				case ',': t += "000011"; break;
				case '-': t += "10010001"; break;
				case '.': t += "010001"; break;
				case '?': t += "000001"; break;
			}
		}
		while(t.size() % 5 != 0) t = t + '0';
		string u;
		for(int i = 0; i < t.size(); i += 5) {
			int r = 0;
			for(int j = i; j < i + 5; j++) {
				r *= 2;
				if(t[j] == '1') r++;
			}
			if(r < 26) u += (char)(r + 65);
			else if(r == 26) u += ' ';
			else if(r == 27) u += '.';
			else if(r == 28) u += ',';
			else if(r == 29) u += '-';
			else if(r == 30) u += '\'';
			else u += '?';
		}
		cout << u << endl;
	}
}