Problem:


博士が愛した符号

博士 : ピーター君、ついにやったよ。

ピーター : どうしました、デビッド博士？またくだらない発明ですか？

博士 : この表だよ、この表。

文字符号

（空白）101

'000000

,000011

-10010001

.010001

?000001

A100101

B10011010

文字符号

 C 0101

 D 0001

 E 110

 F 01001

 G 10011011

 H 010000

 I 0111

 J 10011000

文字符号

 K 0110

 L 00100

 M 10011001

 N 10011110

 O 00101

 P 111

 Q 10011111

 R 1000

文字符号

 S 00110

 T 00111

 U 10011100

 V 10011101

 W 000010

 X 10010010

 Y 10010011

 Z 10010000

ピーター : なんですか? この表は。

博士 : いいから、言う通りにしてみなさい。まず、お前の名前を紙に書いてごらん。

ピーター : はい"PETER POTTER" っと。

博士 : そうしたら、１文字ずつ、この表の「符号」に置き換えるのだよ。

ピーター : えーと"P" を「111」にして"E" を「110」して…結構面倒ですね。

111 110 00111 110 1000 101 111 00101 00111 00111 110 1000

           になりました。なんだか、バーコードみたいですね。

博士 : よろしい。そうしたら、置き換えた文字列を全部つなげて、５文字ごとに区切ってみなさい。

ピーター : はいはい、つなげて区切ると。

11111 00011 11101 00010 11110 01010 01110 01111 10100 0

           こんな感じになりました。けど、最後の「0」だけのやつはどうしますか?

博士 : ０を付け加えて５文字にしておいてくれ。

ピーター : えーと最後が０が1個だけだから０をあと４つ加えてやればいいんですね。できました。

11111 00011 11101 00010 11110 01010 01110 01111 10100 00000

博士 : 次はこの表を使うのだ。

符号文字

 00000 A

 00001 B

 00010 C

 00011 D

 00100 E

 00101 F

 00110 G

 00111 H

符号文字

 01000 I

 01001 J

 01010 K

 01011 L

 01100 M

 01101 N

 01110 O

 01111 P

符号文字

 10000 Q

 10001 R

 10010 S

 10011 T

 10100 U

 10101 V

 10110 W

 10111 X

符号文字

 11000 Y

 11001 Z

 11010 （空白）

 11011 .

 11100 ,

 11101 -

 11110 '

 11111 ?

ピーター : これをどう使うんですか…そうか!今度は符号から文字に置き換えるのか!

博士 : そうそう。「11111」だったら「?」に、「00011」だったら「D」にとやってゆけばいいんだよ。

ピーター : これは単純ですね……えーと「?D-C'KOPUA」になりました。でも意味不明ですよ。

博士 : 文字数を数えてごらん。

ピーター : １０文字ですよ。あっ、「PETER POTTER」は１２文字だったのに２文字減っています。

博士 : そう、この表を使えば文字を減らすことができるのだよ。じゃあ今度はこの文章で同じことをやっ
       てごらん。

PETER PIPER PICKED A PECK OF PICKLED PEPPERS. A PECK OF PICKLED PEPPERS
PETER PIPER PICKED. IF PETER PIPER PICKED A PECK OF PICKLED PEPPERS, WHERE'S
THE PECK OF PICKLED PEPPERS PETER PIPER PICKED?

ピーター : ぎょぎょ、行が分かれていますが、どうするんですか?

博士 : 紙の都合で３行になってしまったが、改行文字のかわりに空白がある長い１行だと思っておくれ。

ピーター : はいはい。行と行の間にあるのは空白だと。しかし面倒だな……。

博士 : だったらプログラムにやらせればいいではないか。

ということで、ピーターの代わりに、読み込んだ文字列を符号に変換し出力するプログラムを作成してください。

入力

複数のデータセットが与えられます。各データセットに文字列１行（表に含まれる文字からなる）が与えられます。文字列に含まれる文字の数は 1 文字以上 100 文字以下です。

データセットの数は 200 を超えません。

出力

各データセットごとに、変換後の文字列を１行に出力してください。

Sample Input

PETER POTTER

Output for the Sample Input

?D-C'KOPUA



Sample input:
PETER POTTER


Sample output:
?D-C'KOPUA

Submission status: Wrong Answer

Solution code:
enc_s = " |'|,|-|.|?|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z"
enc_i = "101|000000|000011|10010001|010001|000001|100101|10011010|0101|0001|110|01001|10011011|010000|0111|10011000|0110|00100|10011001|10011110|00101|111|10011111|1000|00110|00111|10011100|10011101|000010|10010010|10010011|10010000"
enc = dict(zip([i for i in enc_s.split("|")],[i for i in enc_i.split("|")]))
dec_s = "A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z| |.|,|-|'|?"
dec_i = "00000|00001|00010|00011|00100|00101|00110|00111|01000|01001|01010|01011|01100|01101|01110|01111|10000|10001|10010|10011|10100|10101|10110|10111|11000|11001|11010|11011|11100|11101|11110|11111"
dec = dict(zip([i for i in dec_i.split("|")],[i for i in dec_s.split("|")]))
def encode(a):
    return "".join([enc[i] for i in list(a)])
def decode(a):
    return "".join([dec[i] for i in a])

while(1):
    try:
        a = input()
        encoded = encode(a)
        l = len(encoded)%5
        encoded = encoded + "0"*(5-l)
        l_ = int(len(encoded)/5)
        enc_list = [encoded[5*i:5*(i+1)] for i in range(l_)]
        decoded = decode(enc_list)
        print(decoded)
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
encode={
" ":"101",
"'":"000000",
",":"000011",
"-":"10010001",
".":"010001",
"?":"000001",
"A":"100101",
"B":"10011010",
"C":"0101",
"D":"0001",
"E":"110",
"F":"01001",
"G":"10011011",
"H":"010000",
"I":"0111",
"J":"10011000",
"K":"0110",
"L":"00100",
"M":"10011001",
"N":"10011110",
"O":"00101",
"P":"111",
"Q":"10011111",
"R":"1000",
"S":"00110",
"T":"00111",
"U":"10011100",
"V":"10011101",
"W":"000010",
"X":"10010010",
"Y":"10010011",
"Z":"10010000"
}
decode={
"00000":"A",
"00001":"B",
"00010":"C",
"00011":"D",
"00100":"E",
"00101":"F",
"00110":"G",
"00111":"H",
"01000":"I",
"01001":"J",
"01010":"K",
"01011":"L",
"01100":"M",
"01101":"N",
"01110":"O",
"01111":"P",
"10000":"Q",
"10001":"R",
"10010":"S",
"10011":"T",
"10100":"U",
"10101":"V",
"10110":"W",
"10111":"X",
"11000":"Y",
"11001":"Z",
"11010":" ",
"11011":".",
"11100":",",
"11101":"-",
"11110":"'",
"11111":"?"
}

def coding():
    code = ""
    stri = ""
    st = raw_input()
    for s in st:
        code += encode[s]
    b = 0
    while True:
        if len(code) < b+5:
            stri += decode[code[b:].zfill(5)]
            break
        stri += decode[code[b:b+5]]
        b += 5
    return stri

while True:
    try:
        print coding()
    except:
        break

Submission status: Wrong Answer

Solution code:
encode={
" ":"101",
"'":"000000",
",":"000011",
"-":"10010001",
".":"010001",
"?":"000001",
"A":"100101",
"B":"10011010",
"C":"0101",
"D":"0001",
"E":"110",
"F":"01001",
"G":"10011011",
"H":"010000",
"I":"0111",
"J":"10011000",
"K":"0110",
"L":"00100",
"M":"10011001",
"N":"10011110",
"O":"00101",
"P":"111",
"Q":"10011111",
"R":"1000",
"S":"00110",
"T":"00111",
"U":"10011100",
"V":"10011101",
"W":"000010",
"X":"10010010",
"Y":"10010011",
"Z":"10010000"
}
decode={
"00000":"A",
"00001":"B",
"00010":"C",
"00011":"D",
"00100":"E",
"00101":"F",
"00110":"G",
"00111":"H",
"01000":"I",
"01001":"J",
"01010":"K",
"01011":"L",
"01100":"M",
"01101":"N",
"01110":"O",
"01111":"P",
"10000":"Q",
"10001":"R",
"10010":"S",
"10011":"T",
"10100":"U",
"10101":"V",
"10110":"W",
"10111":"X",
"11000":"Y",
"11001":"Z",
"11010":" ",
"11011":".",
"11100":",",
"11101":"-",
"11110":"'",
"11111":"?"
}

def coding():
    code = ""
    stri = ""
    st = raw_input()
    for s in st:
        code += encode[s]
    b = 0
    while True:
        if len(code) == b+5:
            stri += decode[code[b:b+5]]
            break
        elif len(code) < b+5:
            stri += decode[code[b:].zfill(5)]
            break
        stri += decode[code[b:b+5]]
        b += 5
    return stri

while True:
    try:
        print coding()
    except:
        break

Submission status: Wrong Answer

Solution code:
import sys
f = sys.stdin


k1 = {' ':'101'
,"'":'000000'
,',':'000011'
,'-':'10010001'
,'.':'010001'
,'?':'000001'
,'A':'100101'
,'B':'10011010'
,'C':'0101'
,'D':'0001'
,'E':'110'
,'F':'01001'
,'G':'10011011'
,'H':'010000'
,'I':'0111'
,'J':'10011000'
,'K':'0110'
,'L':'00100'
,'M':'10011001'
,'N':'10011110'
,'O':'00101'
,'P':'111'
,'Q':'10011111'
,'R':'1000'
,'S':'00110'
,'T':'00111'
,'U':'10011100'
,'V':'10011101'
,'W':'000010'
,'X':'10010010'
,'Y':'10010011'
,'Z':'10010000'}
import string
k2 = string.ascii_uppercase + " .,-'?"

for line in f:
    cipher = ''
    for c in line.strip():
        cipher += k1[c]

    #5の倍数に0フィル
    cipher += '0' * (5 - len(cipher) % 5)

    for i in range(0, len(cipher),5):
        num = int(cipher[i:i + 5],2)
        print(k2[num],end='')
    print()

Submission status: Wrong Answer

Solution code:
import sys
f = sys.stdin

k1 = {' ':'101'
,"'":'000000'
,',':'000011'
,'-':'10010001'
,'.':'010001'
,'?':'000001'
,'A':'100101'
,'B':'10011010'
,'C':'0101'
,'D':'0001'
,'E':'110'
,'F':'01001'
,'G':'10011011'
,'H':'010000'
,'I':'0111'
,'J':'10011000'
,'K':'0110'
,'L':'00100'
,'M':'10011001'
,'N':'10011110'
,'O':'00101'
,'P':'111'
,'Q':'10011111'
,'R':'1000'
,'S':'00110'
,'T':'00111'
,'U':'10011100'
,'V':'10011101'
,'W':'000010'
,'X':'10010010'
,'Y':'10010011'
,'Z':'10010000'
,'\n':''}
import string
k2 = string.ascii_uppercase + " .,-'?"

for line in f:
    cipher = ''
    for c in line:
        cipher += k1[c]

    #5の倍数に0フィル
    cipher += '0' * (5 - len(cipher) % 5)

    for i in range(0, len(cipher),5):
        num = int(cipher[i:i + 5],2)
        print(k2[num],end='')
    print()

Submission status: Wrong Answer

Solution code:
import sys
f = sys.stdin

k1 = {
" ":"101",
"'":"000000",
",":"000011",
"-":"10010001",
".":"010001",
"?":"000001",
"A":"100101",
"B":"10011010",
"C":"0101",
"D":"0001",
"E":"110",
"F":"01001",
"G":"10011011",
"H":"010000",
"I":"0111",
"J":"10011000",
"K":"0110",
"L":"00100",
"M":"10011001",
"N":"10011110",
"O":"00101",
"P":"111",
"Q":"10011111",
"R":"1000",
"S":"00110",
"T":"00111",
"U":"10011100",
"V":"10011101",
"W":"000010",
"X":"10010010",
"Y":"10010011",
"Z":"10010000"}
import string
k2 = string.ascii_uppercase + " .,-'?"

while True:
    line = f.readline().strip()
    if not line:
        break
    c1 = c2 = ''
    for c in line:
        c1 += k1[c]

    #5の倍数に0フィル
    c1 += '0' * (5 - len(c1) % 5)

    for i in range(0, len(c1),5):
        c2 += k2[ int(c1[i:i + 5],2)]
    print(c2)

Submission status: Wrong Answer

Solution code:
import sys
f = sys.stdin

k1 = {
" ":"101",
"'":"000000",
",":"000011",
"-":"10010001",
".":"010001",
"?":"000001",
"A":"100101",
"B":"10011010",
"C":"0101",
"D":"0001",
"E":"110",
"F":"01001",
"G":"10011011",
"H":"010000",
"I":"0111",
"J":"10011000",
"K":"0110",
"L":"00100",
"M":"10011001",
"N":"10011110",
"O":"00101",
"P":"111",
"Q":"10011111",
"R":"1000",
"S":"00110",
"T":"00111",
"U":"10011100",
"V":"10011101",
"W":"000010",
"X":"10010010",
"Y":"10010011",
"Z":"10010000"}
import string
k2 = string.ascii_uppercase + " .,-'?"

for line in f:
    c1 = c2 = ''
    for c in line.strip():
        c1 += k1[c]

    #5の倍数に0フィル
    c1 += '0' * (- len(c1) % 5)

    for i in range(0, len(c1),5):
        c2 += k2[ int(c1[i:i + 5],2)]
    print(c2)

Submission status: Wrong Answer

Solution code:
import sys

def suicide(sentence):
    string = ''
    for c in sentence:
        string += dic[c]
    lis = []
    while string:
        lis.append(string[:5])
        string = string[5:]
    for i in range(5-len(lis[-1])):
        lis[-1] = lis[-1] + '0'
    absolutely_fantastic(lis)
        
def absolutely_fantastic(lis):
    ans = ''
    for v in lis:
        a = 0
        for i in range(5):
            a += 2**(4-i)*int(v[i])
        else:
            ans += mathematics[a]
    else:
        print ans

dic = {' ':'101', "'":'000000', ',':'000011', '-':'10010001', '.':'010001', '?':'000001', 'A':'100101', 'B':'10011010', 'C':'0101',
       'D':'0001', 'E':'110', 'F':'01001', 'G':'10011011', 'H':'010000', 'I':'0111', 'J':'10011000', 'K':'0110',
       'L':'00100', 'M':'10011001', 'N':'10011110', 'O':'00101', 'P':'111', 'Q':'10011111', 'R':'1000',
       'S':'00110', 'T':'00111', 'U':'10011100', 'V':'10011101', 'W':'000010', 'X':'10010010', 'Y':'10010011', 'Z':'10010000'}

mathematics = {0:'A', 1:'B', 2:'C', 3:'D', 4:'E', 5:'F', 6:'G', 7:'H', 
               8:'I', 9:'J', 10:'K', 11:'L', 12:'M', 13:'N', 14:'O', 15:'P', 
               16:'Q', 17:'R', 18:'S', 19:'T', 20:'U', 21:'V', 22:'W', 23:'X',
               24:'Y', 25:'Z', 26:' ', 27:'.', 28:',', 29:'-', 30:"'", 31:'?',}

if __name__ == '__main__':
    for line in sys.stdin:
        suicide(line.rstrip())

Submission status: Wrong Answer

Solution code:
encode={
" ":"101",
"'":"000000",
",":"000011",
"-":"10010001",
".":"010001",
"?":"000001",
"A":"100101",
"B":"10011010",
"C":"0101",
"D":"0001",
"E":"110",
"F":"01001",
"G":"10011011",
"H":"010000",
"I":"0111",
"J":"10011000",
"K":"0110",
"L":"00100",
"M":"10011001",
"N":"10011110",
"O":"00101",
"P":"111",
"Q":"10011111",
"R":"1000",
"S":"00110",
"T":"00111",
"U":"10011100",
"V":"10011101",
"W":"000010",
"X":"10010010",
"Y":"10010011",
"Z":"10010000"
}
decode={
"00000":"A",
"00001":"B",
"00010":"C",
"00011":"D",
"00100":"E",
"00101":"F",
"00110":"G",
"00111":"H",
"01000":"I",
"01001":"J",
"01010":"K",
"01011":"L",
"01100":"M",
"01101":"N",
"01110":"O",
"01111":"P",
"10000":"Q",
"10001":"R",
"10010":"S",
"10011":"T",
"10100":"U",
"10101":"V",
"10110":"W",
"10111":"X",
"11000":"Y",
"11001":"Z",
"11010":" ",
"11011":".",
"11100":",",
"11101":"-",
"11110":"'",
"11111":"?"
}

def doc_string():
    """
    I can fly.
    """

while True:
	try:
		list = raw_input()
	except EOFError:
		break
	code = ""
	for i in xrange(len(list)):
		code += encode[list[i:i+1]]
	
	for i in xrange(5 - len(code) % 5):
		code += "0"
	
	fffff = ""
	for i in xrange(len(code) / 5):
		fffff += decode[code[i*5:i*5+5]]
	
	print fffff

Submission status: Wrong Answer

Solution code:
encode = {
" ":"101",
"'":"000000",
",":"000011",
"-":"10010001",
".":"010001",
"?":"000001",
"A":"100101",
"B":"10011010",
"C":"0101",
"D":"0001",
"E":"110",
"F":"01001",
"G":"10011011",
"H":"010000",
"I":"0111",
"J":"10011000",
"K":"0110",
"L":"00100",
"M":"10011001",
"N":"10011110",
"O":"00101",
"P":"111",
"Q":"10011111",
"R":"1000",
"S":"00110",
"T":"00111",
"U":"10011100",
"V":"10011101",
"W":"000010",
"X":"10010010",
"Y":"10010011",
"Z":"10010000"
}
decode = {
"00000":"A",
"00001":"B",
"00010":"C",
"00011":"D",
"00100":"E",
"00101":"F",
"00110":"G",
"00111":"H",
"01000":"I",
"01001":"J",
"01010":"K",
"01011":"L",
"01100":"M",
"01101":"N",
"01110":"O",
"01111":"P",
"10000":"Q",
"10001":"R",
"10010":"S",
"10011":"T",
"10100":"U",
"10101":"V",
"10110":"W",
"10111":"X",
"11000":"Y",
"11001":"Z",
"11010":" ",
"11011":".",
"11100":",",
"11101":"-",
"11110":"'",
"11111":"?"
}

def doc_string():
    """
    I can fly.
    """

while True:
	try:
		list = raw_input()
	except EOFError:
		break
	code = ""
	for i in xrange(len(list)):
		code += encode[list[i:i+1]]
	
	for i in xrange(5 - len(code) % 5):
		code += "0"
	
	fffff = ""
	for i in xrange(len(code) / 5):
		fffff += decode[code[i*5:i*5+5]]
	
	print fffff

Submission status: Wrong Answer

Solution code:
encode = {
" ":"101",
"'":"000000",
",":"000011",
"-":"10010001",
".":"010001",
"?":"000001",
"A":"100101",
"B":"10011010",
"C":"0101",
"D":"0001",
"E":"110",
"F":"01001",
"G":"10011011",
"H":"010000",
"I":"0111",
"J":"10011000",
"K":"0110",
"L":"00100",
"M":"10011001",
"N":"10011110",
"O":"00101",
"P":"111",
"Q":"10011111",
"R":"1000",
"S":"00110",
"T":"00111",
"U":"10011100",
"V":"10011101",
"W":"000010",
"X":"10010010",
"Y":"10010011",
"Z":"10010000"
}
decode = {
"00000":"A",
"00001":"B",
"00010":"C",
"00011":"D",
"00100":"E",
"00101":"F",
"00110":"G",
"00111":"H",
"01000":"I",
"01001":"J",
"01010":"K",
"01011":"L",
"01100":"M",
"01101":"N",
"01110":"O",
"01111":"P",
"10000":"Q",
"10001":"R",
"10010":"S",
"10011":"T",
"10100":"U",
"10101":"V",
"10110":"W",
"10111":"X",
"11000":"Y",
"11001":"Z",
"11010":" ",
"11011":".",
"11100":",",
"11101":"-",
"11110":"'",
"11111":"?"
}
while True:
	try:
		list = str(raw_input())
	except EOFError:
		break
	code = ""
	for i in xrange(len(list)):
		code += encode[list[i:i+1]]
	
	for i in xrange(5 - len(code) % 5):
		code += "0"
	
	list = ""
	for i in xrange(len(code) / 5):
		list += decode[code[i*5:i*5+5]]
	
	print list

Submission status: Wrong Answer

Solution code:
encode = {
" ":"101",
"'":"000000",
",":"000011",
"-":"10010001",
".":"010001",
"?":"000001",
"A":"100101",
"B":"10011010",
"C":"0101",
"D":"0001",
"E":"110",
"F":"01001",
"G":"10011011",
"H":"010000",
"I":"0111",
"J":"10011000",
"K":"0110",
"L":"00100",
"M":"10011001",
"N":"10011110",
"O":"00101",
"P":"111",
"Q":"10011111",
"R":"1000",
"S":"00110",
"T":"00111",
"U":"10011100",
"V":"10011101",
"W":"000010",
"X":"10010010",
"Y":"10010011",
"Z":"10010000"
}
decode = {
"00000":"A",
"00001":"B",
"00010":"C",
"00011":"D",
"00100":"E",
"00101":"F",
"00110":"G",
"00111":"H",
"01000":"I",
"01001":"J",
"01010":"K",
"01011":"L",
"01100":"M",
"01101":"N",
"01110":"O",
"01111":"P",
"10000":"Q",
"10001":"R",
"10010":"S",
"10011":"T",
"10100":"U",
"10101":"V",
"10110":"W",
"10111":"X",
"11000":"Y",
"11001":"Z",
"11010":" ",
"11011":".",
"11100":",",
"11101":"-",
"11110":"'",
"11111":"?"
}
while True:
	try:
		list = str(raw_input())
	except EOFError:
		break
	code = ""
	for i in range(len(list)):
		code += encode[list[i:i+1]]
	
	for i in range(5 - len(code) % 5):
		code += "0"
	
	list = ""
	for i in range(len(code) / 5):
		list += decode[code[i*5:i*5+5]]
	
	print list

Submission status: Wrong Answer

Solution code:
d1 = {
' ':'101'
,'\'':'000000'
,',':'000011'
,'-':'10010001'
,'.':'010001'
,'?':'000001'
,'A':'100101'
,'B':'10011010'
,'C':'0101'
,'D':'0001'
,'E':'110'
,'F':'01001'
,'G':'10011011'
,'H':'010000'
,'I':'0111'
,'J':'10011000'
,'K':'0110'
,'L':'00100'
,'M':'10011001'
,'N':'10011110'
,'O':'00101'
,'P':'111'
,'Q':'10011111'
,'R':'1000'
,'S':'00110'
,'T':'00111'
,'U':'10011100'
,'V':'10011101'
,'W':'000010'
,'X':'10010010'
,'Y':'10010011'
,'Z':'10010000'
}

d2 = {
'00000':'A'
,'00001':'B'
,'00010':'C'
,'00011':'D'
,'00100':'E'
,'00101':'F'
,'00110':'G'
,'00111':'H'
,'01000':'I'
,'01001':'J'
,'01010':'K'
,'01011':'L'
,'01100':'M'
,'01101':'N'
,'01110':'O'
,'01111':'P'
,'10000':'Q'
,'10001':'R'
,'10010':'S'
,'10011':'T'
,'10100':'U'
,'10101':'V'
,'10110':'W'
,'10111':'X'
,'11000':'Y'
,'11001':'Z'
,'11010':' '
,'11011':'.'
,'11100':','
,'11101':'-'
,'11110':'\''
,'11111':'?'
}

s1 = input()
s2 = ''
s3 = ''
for i in range(len(s1)):
    s2 += d1[s1[i]]
if len(s2)%5 != 0:
    s2 += '0'*(5-len(s2)%5)
for i in range(len(s2)//5):
    s3 += d2[s2[i*5:(i+1)*5]]
    
print(s3)

Submission status: Wrong Answer

Solution code:
import sys
d1 = {
' ':'101'
,'\'':'000000'
,',':'000011'
,'-':'10010001'
,'.':'010001'
,'?':'000001'
,'A':'100101'
,'B':'10011010'
,'C':'0101'
,'D':'0001'
,'E':'110'
,'F':'01001'
,'G':'10011011'
,'H':'010000'
,'I':'0111'
,'J':'10011000'
,'K':'0110'
,'L':'00100'
,'M':'10011001'
,'N':'10011110'
,'O':'00101'
,'P':'111'
,'Q':'10011111'
,'R':'1000'
,'S':'00110'
,'T':'00111'
,'U':'10011100'
,'V':'10011101'
,'W':'000010'
,'X':'10010010'
,'Y':'10010011'
,'Z':'10010000'
}

d2 = {
'00000':'A'
,'00001':'B'
,'00010':'C'
,'00011':'D'
,'00100':'E'
,'00101':'F'
,'00110':'G'
,'00111':'H'
,'01000':'I'
,'01001':'J'
,'01010':'K'
,'01011':'L'
,'01100':'M'
,'01101':'N'
,'01110':'O'
,'01111':'P'
,'10000':'Q'
,'10001':'R'
,'10010':'S'
,'10011':'T'
,'10100':'U'
,'10101':'V'
,'10110':'W'
,'10111':'X'
,'11000':'Y'
,'11001':'Z'
,'11010':' '
,'11011':'.'
,'11100':','
,'11101':'-'
,'11110':'\''
,'11111':'?'
}
for line in sys.stdin:
    s1 = line.rstrip()
    s2 = ''
    s3 = ''
    for i in range(len(s1)):
        s2 += d1[s1[i]]
    if len(s2)%5 != 0:
        s2 += '0'*(5-len(s2)%5)
    
    for i in range(len(s2)//5):
        s3 += d2[s2[i*5:(i+1)*5]]
        
    print(s3)

Submission status: Wrong Answer

Solution code:
en=[chr(i) for i in range(65,91)]+list(' .,-\'?')
de={
' ':'101','\'':'000000',',':'000011','-':'10010001','.':'010001','?':'000001',
'A':'100101','B':'10011010','C':'0101','D':'0001','E':'110','F':'01001',
'G':'10011011','H':'010000','I':'0111','J':'10011000','K':'0110','L':'00100',
'M':'10011001','N':'10011110','O':'00101','P':'111','Q':'10011111','R':'1000',
'S':'00110','T':'00111','U':'10011100','V':'10011101','W':'000010','X':'10010010',
'Y':'10010011','Z':'10010000'}
a=''
for x in list(input()):
    a+=de[x]
a+='0'*(-len(a)%5)
for i in range(0,len(a),5):
    print(en[int(a[i:i+5],2)],end='')
print()

Submission status: Wrong Answer

Solution code:
en=[chr(i) for i in range(65,91)]+list(' .,-\'?')
de={
' ':'101','\'':'000000',',':'000011','-':'10010001','.':'010001','?':'000001',
'A':'100101','B':'10011010','C':'0101','D':'0001','E':'110','F':'01001',
'G':'10011011','H':'010000','I':'0111','J':'10011000','K':'0110','L':'00100',
'M':'10011001','N':'10011110','O':'00101','P':'111','Q':'10011111','R':'1000',
'S':'00110','T':'00111','U':'10011100','V':'10011101','W':'000010','X':'10010010',
'Y':'10010011','Z':'10010000'}
a=b=''
for x in list(input()):
    a+=de[x]
a+='0'*(-len(a)%5)
for i in range(0,len(a),5):
    b+=en[int(a[i:i+5],2)]
print(b)

Submission status: Wrong Answer

Solution code:
en=[chr(i) for i in range(65,91)]+list(' .,-\'?')
de={
' ':'101'
,'\'':'000000'
,',':'000011'
,'-':'10010001'
,'.':'010001'
,'?':'000001'
,'A':'100101'
,'B':'10011010'
,'C':'0101'
,'D':'0001'
,'E':'110'
,'F':'01001'
,'G':'10011011'
,'H':'010000'
,'I':'0111'
,'J':'10011000'
,'K':'0110'
,'L':'00100'
,'M':'10011001'
,'N':'10011110'
,'O':'00101'
,'P':'111'
,'Q':'10011111'
,'R':'1000'
,'S':'00110'
,'T':'00111'
,'U':'10011100'
,'V':'10011101'
,'W':'000010'
,'X':'10010010'
,'Y':'10010011'
,'Z':'10010000'
}
a=b=''
for x in list(input()):
    a+=de[x]
a+='0'*(-len(a)%5)
for i in range(len(a)//5):
    b+=en[int(a[i*5:(i+1)*5],2)]
print(b)

Submission status: Wrong Answer

Solution code:
class Code:
    def __init__(self): 
        self.cd1 = {" ":"101","'":"000000",",":"000011","-":"10010001",".":"010001","?":"000001","A":"100101","B":"10011010","C":"0101","D":"0001","E":"110","F":"01001","G":"10011011","H":"010000","I":"0111","J":"10011000","K":"0110","L":"00100","M":"10011001","N":"10011110","O":"00101","P":"111","Q":"10011111","R":"1000","S":"00110","T":"00111","U":"10011100","V":"10011101","W":"000010","X":"10010010","Y":"10010011","Z":"10010000"}
        self.cd2 = {"00000":"A","00001":"B","00010":"C","00011":"D","00100":"E","00101":"F","00110":"G","00111":"H","01000":"I","01001":"J","01010":"K","01011":"L","01100":"M","01101":"N","01110":"O","01111":"P","10000":"Q","10001":"R","10010":"S","10011":"T","10100":"U","10101":"V","10110":"W","10111":"X","11000":"Y","11001":"Z","11010":" ","11011":".","11100":",","11101":"-","11110":"'","11111":"?"}

    def code1(self,s):
        t0 = list(map(lambda x:self.cd1[x], s))
        t1 = ''.join(t0)
        t = list(t1)
        t0 = t
        u = []
        while len(t) > 0:
            u.append(t[0:5])
            t[0:5]=[]
        if len(u[-1]) != 5:
            u[-1] = (u[-1] + ['0']*4)[0:5]
        v = list(map(lambda x:''.join(x), u))
        return(v)

    def code2(self,s):
        t = []
        for i in s: 
            t.append(self.cd2[i])
        u = ''.join(t)
        return(u)

if __name__ == "__main__":
    cd = Code()
    while True:
        try:
            s = input().strip()
            t = cd.code1(s)
            u = cd.code2(t)
            print(u)

        except EOFError:
            break

Submission status: Wrong Answer

Solution code:
import sys
import re
class Code:
    def __init__(self): 
        self.cd1 = {" ":"101","'":"000000",",":"000011","-":"10010001",".":"010001","?":"000001","A":"100101","B":"10011010","C":"0101","D":"0001","E":"110","F":"01001","G":"10011011","H":"010000","I":"0111","J":"10011000","K":"0110","L":"00100","M":"10011001","N":"10011110","O":"00101","P":"111","Q":"10011111","R":"1000","S":"00110","T":"00111","U":"10011100","V":"10011101","W":"000010","X":"10010010","Y":"10010011","Z":"10010000"}
        self.cd2 = {"00000":"A","00001":"B","00010":"C","00011":"D","00100":"E","00101":"F","00110":"G","00111":"H","01000":"I","01001":"J","01010":"K","01011":"L","01100":"M","01101":"N","01110":"O","01111":"P","10000":"Q","10001":"R","10010":"S","10011":"T","10100":"U","10101":"V","10110":"W","10111":"X","11000":"Y","11001":"Z","11010":" ","11011":".","11100":",","11101":"-","11110":"'","11111":"?"}

    def code1(self,s):
        t0 = list(map(lambda x:self.cd1[x], s))
        t1 = ''.join(t0)
        t = list(t1)
        t0 = t
        u = []
        while len(t) > 0:
            u.append(t[0:5])
            t[0:5]=[]
        if len(u[-1]) != 5:
            u[-1] = (u[-1] + ['0']*4)[0:5]
        v = list(map(lambda x:''.join(x), u))
        return(v)

    def code2(self,s):
        t = []
        for i in s: 
            t.append(self.cd2[i])
        u = ''.join(t)
        return(u)

if __name__ == "__main__":
    cd = Code()
    s = sys.stdin.read()
    s1 = re.sub(r'\n', ' ', s)
    t = cd.code1(s1)
    u = cd.code2(t)
    print(u)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys
import os
import math

d1 = {
    ' ': '101'
    , '\'': '000000'
    , ',': '000011'
    , '-': '10010001'
    , '.': '010001'
    , '?': '000001'
    , 'A': '100101'
    , 'B': '10011010'
    , 'C': '0101'
    , 'D': '0001'
    , 'E': '110'
    , 'F': '01001'
    , 'G': '10011011'
    , 'H': '010000'
    , 'I': '0111'
    , 'J': '10011000'
    , 'K': '0110'
    , 'L': '00100'
    , 'M': '10011001'
    , 'N': '10011110'
    , 'O': '00101'
    , 'P': '111'
    , 'Q': '10011111'
    , 'R': '1000'
    , 'S': '00110'
    , 'T': '00111'
    , 'U': '10011100'
    , 'V': '10011101'
    , 'W': '000010'
    , 'X': '10010010'
    , 'Y': '10010011'
    , 'Z': '10010000'
}

d2 = {
    '00000': 'A'
    , '00001': 'B'
    , '00010': 'C'
    , '00011': 'D'
    , '00100': 'E'
    , '00101': 'F'
    , '00110': 'G'
    , '00111': 'H'
    , '01000': 'I'
    , '01001': 'J'
    , '01010': 'K'
    , '01011': 'L'
    , '01100': 'M'
    , '01101': 'N'
    , '01110': 'O'
    , '01111': 'P'
    , '10000': 'Q'
    , '10001': 'R'
    , '10010': 'S'
    , '10011': 'T'
    , '10100': 'U'
    , '10101': 'V'
    , '10110': 'W'
    , '10111': 'X'
    , '11000': 'Y'
    , '11001': 'Z'
    , '11010': ' '
    , '11011': '.'
    , '11100': ','
    , '11101': '-'
    , '11110': '\''
    , '11111': '?'
}

S = ''
for s in sys.stdin:
    s = s.strip()
    S += s + ' '
S = S[:-1]

T = ''
for c in S:
    T += d1[c]

# zero addition
if len(T) % 5 != 0:
    add_zero_num = 5 - len(T) % 5
    T += '0' * add_zero_num

U = ''
for i in range(0, len(T), 5):
    binary = T[i:i+5]
    U += d2[binary]

print(U)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys
import os
import math

d1 = {
    ' ': '101'
    , '\'': '000000'
    , ',': '000011'
    , '-': '10010001'
    , '.': '010001'
    , '?': '000001'
    , 'A': '100101'
    , 'B': '10011010'
    , 'C': '0101'
    , 'D': '0001'
    , 'E': '110'
    , 'F': '01001'
    , 'G': '10011011'
    , 'H': '010000'
    , 'I': '0111'
    , 'J': '10011000'
    , 'K': '0110'
    , 'L': '00100'
    , 'M': '10011001'
    , 'N': '10011110'
    , 'O': '00101'
    , 'P': '111'
    , 'Q': '10011111'
    , 'R': '1000'
    , 'S': '00110'
    , 'T': '00111'
    , 'U': '10011100'
    , 'V': '10011101'
    , 'W': '000010'
    , 'X': '10010010'
    , 'Y': '10010011'
    , 'Z': '10010000'
}

d2 = {
    '00000': 'A'
    , '00001': 'B'
    , '00010': 'C'
    , '00011': 'D'
    , '00100': 'E'
    , '00101': 'F'
    , '00110': 'G'
    , '00111': 'H'
    , '01000': 'I'
    , '01001': 'J'
    , '01010': 'K'
    , '01011': 'L'
    , '01100': 'M'
    , '01101': 'N'
    , '01110': 'O'
    , '01111': 'P'
    , '10000': 'Q'
    , '10001': 'R'
    , '10010': 'S'
    , '10011': 'T'
    , '10100': 'U'
    , '10101': 'V'
    , '10110': 'W'
    , '10111': 'X'
    , '11000': 'Y'
    , '11001': 'Z'
    , '11010': ' '
    , '11011': '.'
    , '11100': ','
    , '11101': '-'
    , '11110': '\''
    , '11111': '?'
}

S = ''
for s in sys.stdin:
    s = s.strip()
    S += s + ' '
S = S[:-1]

T = ''
for c in S:
    T += d1[c]

# zero addition
if len(T) % 5 != 0:
    add_zero_num = 5 - len(T) % 5
    T += '0' * add_zero_num

U = ''
for i in range(0, len(T) // 5):
    binary = T[i*5:i*5+5]
    U += d2[binary]

print(U)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys
import os
import math

d1 = {
    ' ': '101'
    , '\'': '000000'
    , ',': '000011'
    , '-': '10010001'
    , '.': '010001'
    , '?': '000001'
    , 'A': '100101'
    , 'B': '10011010'
    , 'C': '0101'
    , 'D': '0001'
    , 'E': '110'
    , 'F': '01001'
    , 'G': '10011011'
    , 'H': '010000'
    , 'I': '0111'
    , 'J': '10011000'
    , 'K': '0110'
    , 'L': '00100'
    , 'M': '10011001'
    , 'N': '10011110'
    , 'O': '00101'
    , 'P': '111'
    , 'Q': '10011111'
    , 'R': '1000'
    , 'S': '00110'
    , 'T': '00111'
    , 'U': '10011100'
    , 'V': '10011101'
    , 'W': '000010'
    , 'X': '10010010'
    , 'Y': '10010011'
    , 'Z': '10010000'
}

d2 = {
    '00000': 'A'
    , '00001': 'B'
    , '00010': 'C'
    , '00011': 'D'
    , '00100': 'E'
    , '00101': 'F'
    , '00110': 'G'
    , '00111': 'H'
    , '01000': 'I'
    , '01001': 'J'
    , '01010': 'K'
    , '01011': 'L'
    , '01100': 'M'
    , '01101': 'N'
    , '01110': 'O'
    , '01111': 'P'
    , '10000': 'Q'
    , '10001': 'R'
    , '10010': 'S'
    , '10011': 'T'
    , '10100': 'U'
    , '10101': 'V'
    , '10110': 'W'
    , '10111': 'X'
    , '11000': 'Y'
    , '11001': 'Z'
    , '11010': ' '
    , '11011': '.'
    , '11100': ','
    , '11101': '-'
    , '11110': '\''
    , '11111': '?'
}

S = ''
for s in sys.stdin:
    s = s.rstrip('\n')
    S += s + ' '
S = S[:-1]

T = ''
for c in S:
    T += d1[c]

# zero addition
if len(T) % 5 != 0:
    add_zero_num = 5 - len(T) % 5
    T += '0' * add_zero_num

U = ''
for i in range(0, len(T), 5):
    binary = T[i:i+5]
    U += d2[binary]

print(U)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys
import os
import math

d1 = {
    ' ': '101'
    , '\'': '000000'
    , ',': '000011'
    , '-': '10010001'
    , '.': '010001'
    , '?': '000001'
    , 'A': '100101'
    , 'B': '10011010'
    , 'C': '0101'
    , 'D': '0001'
    , 'E': '110'
    , 'F': '01001'
    , 'G': '10011011'
    , 'H': '010000'
    , 'I': '0111'
    , 'J': '10011000'
    , 'K': '0110'
    , 'L': '00100'
    , 'M': '10011001'
    , 'N': '10011110'
    , 'O': '00101'
    , 'P': '111'
    , 'Q': '10011111'
    , 'R': '1000'
    , 'S': '00110'
    , 'T': '00111'
    , 'U': '10011100'
    , 'V': '10011101'
    , 'W': '000010'
    , 'X': '10010010'
    , 'Y': '10010011'
    , 'Z': '10010000'
}

d2 = {
    '00000': 'A'
    , '00001': 'B'
    , '00010': 'C'
    , '00011': 'D'
    , '00100': 'E'
    , '00101': 'F'
    , '00110': 'G'
    , '00111': 'H'
    , '01000': 'I'
    , '01001': 'J'
    , '01010': 'K'
    , '01011': 'L'
    , '01100': 'M'
    , '01101': 'N'
    , '01110': 'O'
    , '01111': 'P'
    , '10000': 'Q'
    , '10001': 'R'
    , '10010': 'S'
    , '10011': 'T'
    , '10100': 'U'
    , '10101': 'V'
    , '10110': 'W'
    , '10111': 'X'
    , '11000': 'Y'
    , '11001': 'Z'
    , '11010': ' '
    , '11011': '.'
    , '11100': ','
    , '11101': '-'
    , '11110': '\''
    , '11111': '?'
}

S = ''
for s in sys.stdin:
    s = s.rstrip('\n')
    S += s

T = ''
for c in S:
    T += d1[c]

# zero addition
if len(T) % 5 != 0:
    add_zero_num = 5 - len(T) % 5
    T += '0' * add_zero_num

U = ''
for i in range(0, len(T), 5):
    binary = T[i:i+5]
    U += d2[binary]

print(U)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys
import os
import math

d1 = {
    ' ': '101'
    , '\'': '000000'
    , ',': '000011'
    , '-': '10010001'
    , '.': '010001'
    , '?': '000001'
    , 'A': '100101'
    , 'B': '10011010'
    , 'C': '0101'
    , 'D': '0001'
    , 'E': '110'
    , 'F': '01001'
    , 'G': '10011011'
    , 'H': '010000'
    , 'I': '0111'
    , 'J': '10011000'
    , 'K': '0110'
    , 'L': '00100'
    , 'M': '10011001'
    , 'N': '10011110'
    , 'O': '00101'
    , 'P': '111'
    , 'Q': '10011111'
    , 'R': '1000'
    , 'S': '00110'
    , 'T': '00111'
    , 'U': '10011100'
    , 'V': '10011101'
    , 'W': '000010'
    , 'X': '10010010'
    , 'Y': '10010011'
    , 'Z': '10010000'
}

d2 = {
    '00000': 'A'
    , '00001': 'B'
    , '00010': 'C'
    , '00011': 'D'
    , '00100': 'E'
    , '00101': 'F'
    , '00110': 'G'
    , '00111': 'H'
    , '01000': 'I'
    , '01001': 'J'
    , '01010': 'K'
    , '01011': 'L'
    , '01100': 'M'
    , '01101': 'N'
    , '01110': 'O'
    , '01111': 'P'
    , '10000': 'Q'
    , '10001': 'R'
    , '10010': 'S'
    , '10011': 'T'
    , '10100': 'U'
    , '10101': 'V'
    , '10110': 'W'
    , '10111': 'X'
    , '11000': 'Y'
    , '11001': 'Z'
    , '11010': ' '
    , '11011': '.'
    , '11100': ','
    , '11101': '-'
    , '11110': '\''
    , '11111': '?'
}

S = ''
for s in sys.stdin:
    s = s.rstrip('\n')
    S += s

T = ''
for c in S:
    T += d1[c]

# zero padding
T += '0' * (-len(T) % 5)

U = ''
for i in range(0, len(T), 5):
    binary = T[i:i+5]
    U += d2[binary]

print(U)