Doing decimal & hex decoding separately results in a nicer code which does not refer to string matching and slicing.