Decrypt String from Alphabet to Integer Mapping
class Solution:
def freqAlphabets(self, s: str) -> str:
rec1 = dict(zip(
'1|2|3|4|5|6|7|8|9'.split('|'),
'a|b|c|d|e|f|g|h|i'.split('|')
))
rec2 = dict(zip(
'10#|11#|12#|13#|14#|15#|16#|17#|18#|19#|20#|21#|22#|23#|24#|25#|26#'.split('|'),
'j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z'.split('|')
))
lx = 0
result = []
while lx < len(s):
if lx < len(s) - 2 and s[lx:3 + lx] in rec2:
result.append(rec2[s[lx:3 + lx]])
lx = lx + 3
elif lx < len(s) and s[lx] in rec1:
result.append(rec1[s[lx:1 + lx]])
lx = lx + 1
return ''.join(result)