#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>

using namespace std;

using namespace std;

int main(){

	char base[205],middle[900],result[900];
	int p,tmp;

	while(fgets(base,205,stdin) != 0){

		p = 0;
		for(int i = 0; base[i] != '\0'; i++){
			switch(base[i]){
			case ' ':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '1';
				break;
			case '\'':
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				break;
			case ',':
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				break;
			case '-':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				break;
			case '.':
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				break;
			case '?':
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				break;
			case 'A':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '1';
				break;
			case 'B':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '0';
				break;
			case 'C':
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '1';
				break;
			case 'D':
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				break;
			case 'E':
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '0';
				break;
			case 'F':
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				break;
			case 'G':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				break;
			case 'H':
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				break;
			case 'I':
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '1';
				break;
			case 'J':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				break;
			case 'K':
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '0';
				break;
			case 'L':
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				break;
			case 'M':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				break;
			case 'N':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '0';
				break;
			case 'O':
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '1';
				break;
			case 'P':
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '1';
				break;
			case 'Q':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '1';
				break;
			case 'R':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				break;
			case 'S':
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '0';
				break;
			case 'T':
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '1';
				break;
			case 'U':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				break;
			case 'V':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '1';
				break;
			case 'W':
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '0';
				break;
			case 'X':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '0';
				break;
			case 'Y':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '1';
				break;
			case 'Z':
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '1';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				middle[p++] = '0';
				break;
			}
		}

		if(p % 5 == 1){
			middle[p++] = '0';
			middle[p++] = '0';
			middle[p++] = '0';
			middle[p++] = '0';
		}else if(p % 5 == 2){
			middle[p++] = '0';
			middle[p++] = '0';
			middle[p++] = '0';
		}else if(p % 5 == 3){
			middle[p++] = '0';
			middle[p++] = '0';
		}else if(p % 5 == 4){
			middle[p++] = '0';
		}

		middle[p] = '\0';

		p = 0;

		for(int i = 0; middle[i] != '\0';i += 5){
			tmp = 16*(middle[i] - '0')+ 8*(middle[i+1] - '0') + 4*(middle[i+2] - '0') + 2*(middle[i+3] - '0')+ (middle[i+4] - '0');
			if(tmp <= 25){
				result[p++] = 'A'+tmp;
			}else{
				switch(tmp){
				case 26:
					result[p++] = ' ';
					break;
				case 27:
					result[p++] = '.';
					break;
				case 28:
					result[p++] = ',';
					break;
				case 29:
					result[p++] = '-';
					break;
				case 30:
					result[p++] = '\'';
					break;
				case 31:
					result[p++] = '?';
					break;
				}

			}
			if(middle[i+5] == '\0'){
				result[p] = '\0';
				break;
			}
		}
		printf("%s\n",result);

	}

	return 0;
}