converter
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

Raghu wants to design a converter such that when a user inputs a binary number it gets converted to Octal number & also the correspond alphabet to it.

Example- if a user inputs- 10101101
then the output is 255 BEE

Note : for decimal places there should be a space between the alphabetic signs
Ex- for input  101101101110.111
output -5556.7 EEEF G

A stands for 1, b for 2 , if the octal digit is 0 consider it as a space

SAMPLE INPUT
10101101

SAMPLE OUTPUT
255 BEE


import sys
bin=input();

if "." in bin:
	bdot,adot=bin.split(".")
else:
	bdot=bin
	adot=""

bdot=bdot.lstrip("0")
adot=adot.rstrip("0")

baddz= 3 - (len(bdot)%3)
aaddz= 3 - (len(adot)%3)

if(baddz==3):
	baddz=0
	
if(aaddz==3):
	aaddz=0
	
for i in range(baddz):
	bdot='0'+bdot
		
for i in range(aaddz):
	adot=adot+'0'

octno=""

groupbdot=len(bdot)/3
groupadot=len(adot)/3

for i in range(groupbdot):
	bgrp= bdot[(i*3) + 0]+bdot[(i*3) + 1]+bdot[(i*3) + 2]
	octv= oct(int(bgrp,2)).lstrip("0")
	octno=octno+octv

if "." in bin:
	octno=octno+"."

for i in range(groupadot):
	bgrp= adot[(i*3) + 0]+adot[(i*3) + 1]+adot[(i*3) + 2]
	octv= oct(int(bgrp,2)).lstrip("0")
	octno=octno+octv
	
	

print(octno+" ", end=' ')

arr=[' ','A','B','C','D','E','F','G']

for i in range(len(octno)):
	ch=octno[i]
	
	if(ch=="."):
		sys.stdout.write(" ")
	else:
		sys.stdout.write(arr[int(ch)])




bindict = {'000':0,'001':1,'010':2,'100':4,'101':5,'110':6,'111':7,'011':3}
binary = input().split('.')

for index,value in enumerate(binary):
	arr = []
	if(index==0):   
		while(len(value)%3!=0):
			value='0'+value
		j = 1
		i = 0
		while(j<=len(value)):
			if(j%3==0):
				arr.append(value[i:j])
				i = j
			j+=1
		total = ''
		for k in arr:
			total+=str(bindict[k])
	if(index==1):
		total+='.'
		while(len(value)%3!=0):
			value=value+'0'
		j = 1
		i = 0
		while(j<=len(value)):
			if(j%3==0):
				arr.append(value[i:j])
				i = j
			j+=1
		for k in arr:
			total+=str(bindict[k])
	
	string = ''
	for i in total:
		if(i=='.'):
			string+=' '
		else:
			string+=chr(64+int(i))
print(total+ ' '+string)