Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Hacker Language by B_dur
import datetime
SPECIAL_SIGN=['.',':','!','?','@','$','%']
WHITESPACE_BIN='1000000'
class HackerLanguage:
def __init__(self):
self.decode_text=''
def write(self,text):
self.decode_text+=text
def delete(self,N):
self.decode_text=self.decode_text[:-N]
def send(self):
split_text=self.decode_text.split(' ')
encode_text=[]
for word in split_text:
if self.is_date(word) or self.is_time(word):
encode_text.append(word)
elif self.is_time_ampm(word):
encode_text.append(word[:-2]+self.text_to_bin(word[-2:]))
else:
encode_text.append(''.join([w if w in SPECIAL_SIGN else self.char_to_bin(w) for w in word]))
return WHITESPACE_BIN.join(encode_text)
def read(self,text):
decode_text=''
idx=0
while idx
May 19, 2020
Comments: