fork download
  1. # your code goes here
  2. class Solution:
  3. def originalDigits(self, s: str) -> str:
  4. print(s)
  5. v = [0 for x in range(26)]
  6. si = ''
  7. for i in s:
  8. v[ord(i)-ord('a')] += 1
  9. #print(v[ord(i)-ord('a')])
  10. if(v[ord('z')-ord('a')]):
  11. for i in range(v[ord('z')-ord('a')]):
  12. print('0')
  13. si+='0'
  14. if(v[ord('w')-ord('a')]):
  15. for i in range(v[ord('z')-ord('a')]):
  16. print('2')
  17. si+='2'
  18. if(v[ord('u')-ord('a')]):
  19. for i in range(v[ord('z')-ord('a')]):
  20. print('4')
  21. si+='4'
  22. if(v[ord('x')-ord('a')]):
  23. for i in range(v[ord('z')-ord('a')]):
  24. print('6')
  25. si+='6'
  26. if(v[ord('g')-ord('a')]):
  27. for i in range(v[ord('z')-ord('a')]):
  28. print('8')
  29. si+='8'
  30. return si
  31.  
Success #stdin #stdout 0.03s 9700KB
stdin
Standard input is empty
stdout
Standard output is empty