#include<iostream>
#include<string>
#include<cmath>
#include<map>
using namespace std;
int main(){
	map<char , string> change;
	change[' ']  = "101";
	change['\''] = "000000";
	change[',']  = "000011";
	change['-']  = "10010001";
	change['.']  = "010001";
	change['?']  = "000001";
	change['A']  = "100101";
	change['B']  = "10011010";
	change['C']  = "0101";
	change['D']  = "0001";
	change['E']  = "110";
	change['F']  = "01001";
	change['G']  = "10011011";
	change['H']  = "010000";
	change['I']  = "0111";
	change['J']  = "10011000";
	change['K']  = "0110";
	change['L']  = "00100";
	change['M']  = "10011001";
	change['N']  = "10011110";
	change['O']  = "00101";
	change['P']  = "111";
	change['Q']  = "10011111";
	change['R']  = "1000";
	change['S']  = "00110";
	change['T']  = "00111";
	change['U']  = "10011100";
	change['V']  = "10011101";
	change['W']  = "000010";
	change['X']  = "10010010";
	change['Y']  = "10010011";
	change['Z']  = "10010000";
	
	string str;
	while(getline(cin , str)){
		string sum;
		for(int i = 0; i < str.size(); i++){
			sum += change[str[i]];
		}
		int s = sum.size()%5;
		if(s != 0){
			for(int i = 0; i < 5-s; i++)sum += '0';
		}
		string ans;
		string change2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
		for(int i = 0; i < sum.size(); i+=5){
			int x=0;
			for(int j = i+1; j <= i+5; j++){
				if(sum[j-1] == 49){
					x += (j%5==0) ? 1 : pow(2.0,5-(j%5));
				}
			}
			ans += change2[x];
		}
		cout << ans << endl;
	}
	return 0;
}