class Solution: def trans(self , s: str, n: int) -> str: # write code here lst = s.split(' ') lst = lst[::-1] res = [] for word in lst: tmp = '' for c in word: if c.islower(): tmp += c.upper() elif c.isupper(): tmp += c.lower() res.append(tmp) return ' '.join(res)