#define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cctype>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
using namespace std;
typedef pair<double,double> P;
int b[19][19];


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