Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. word = input()
  2.  
  3. lower_case = [char for char in word if char.islower()]
  4. upper_case = [char for char in word if char.isupper()]
  5. digit_odd_case = [char for char in word if char.isdigit() and int(char) % 2]
  6. digit_even_case = [char for char in word if char.isdigit() and int(char) % 2 == 0]
  7.  
  8. lower_case = ''.join(sorted(lower_case))
  9. upper_case = ''.join(sorted(upper_case))
  10. digit_even_case = ''.join(sorted(digit_even_case))
  11. digit_odd_case = ''.join(sorted(digit_odd_case))
  12.  
  13. print(lower_case + upper_case + digit_odd_case + digit_even_case)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement