fork(1) download
  1. # your code goes here
  2. def RepresentsInt(s):
  3. try:
  4. int(s)
  5. return True
  6. except ValueError:
  7. return False
  8.  
  9. def uncompress(string):
  10. res = " "
  11. for i in range(len(string)):
  12. if(RepresentsInt(string[i])):
  13. #print i
  14. mynum = int(string[i])
  15. for j in range(mynum-1):
  16. res += string[i-1]
  17. else:
  18. res += string[i]
  19. return res
  20.  
  21. print(uncompress("da4f3y2"))
Success #stdin #stdout 0.02s 9016KB
stdin
Standard input is empty
stdout
 daaaafffyy