fork download
  1. class Solution(object):
  2. def reverseWords(self, s):
  3. """
  4. :type s: str
  5. :rtype: str
  6. """
  7. d=[]
  8.  
  9. words=s.split()
  10. for i in words:
  11. d.append(i[::-1])
  12. print d
  13. result=" ".join(d)
  14. return result
  15.  
  16. x = Solution()
  17. print x.reverseWords("Hello world")
Success #stdin #stdout 0s 23352KB
stdin
Standard input is empty
stdout
['olleH']
['olleH', 'dlrow']
olleH dlrow