I made a simple decryption mission with reference to Egyptian hieroglyphs.
Please decrypt the input string using the dictionary.
note:
- Leftmost longest matching rule (e.g. 'lllll' == 'yyi')
- ',' indicates the delimiter (e.g. 'l,ll' == 'iy')
- Characters that do not match the dictionary are output as is.
I would like to get a feedback about this idea.
sample of initial code:
HIERO_DIC = {
r'|\.': 'a',
'_|': 'b',
'_=': 'd',
'v_': 'f',
'A': 'g',
'8': 'h',
'l': 'i',
'^\_': 'j',
'up': 'k',
'_@=_': 'l',
r'^|\.': 'm',
'~~': 'n',
'o~)': 'o',
'[]': 'p',
'/|': 'q',
'()': 'r',
'n': 's',
'(|': 't',
'@': 'w',
'll': 'y',
'-+-': 'z',
}
def ancient_letters(input_string):
return ''
if __name__ == '__main__':
assert ancient_letters(r'c8ecuplo~)') == 'checkio', 'checkio'
assert ancient_letters(r'l _@=_o~)ve []ll(|8o~)~~') == 'i love python', 'i love python'
assert ancient_letters(r'lll,l,ll') == 'yiiy', 'yiiy'
Created at: 2017/03/25 04:07; Updated at: 2017/03/25 04:07