fork download
  1. from functools import reduce
  2.  
  3. DIGITS = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9}
  4.  
  5. def char2num(s):
  6. return DIGITS[s]
  7.  
  8. def str2int(s):
  9. return reduce(lambda x, y: x * 10 + y, map(char2num, s))
  10.  
  11. # your code goes here
Success #stdin #stdout 0.09s 14168KB
stdin
Standard input is empty
stdout
Standard output is empty