• + 0 comments

    def sorting_strings(some_string: str) -> str:

    some_string = list(some_string)   
    some_string.sort(key=lambda x: (x.isdigit(), x.isupper(), x))
    only_numbers = list(filter(lambda x: x.isdigit(), some_string))
    only_letters = list(filter(lambda x: x.isalpha(), some_string))
    odds = list(filter(lambda x: int(x) % 2 == 1, only_numbers))
    evens = list(filter(lambda x: int(x) % 2 == 0, only_numbers))
    

    return ''.join(only_letters+odds+evens)

    if name == 'main': S = input() print(sorting_strings(S))