Sort by

recency

|

1072 Discussions

|

  • + 0 comments

    n = list(input()) n.sort() lower, upper, odd, even = '', '', '', '' for i in n: if i.islower(): lower += i elif i.isupper(): upper += i elif i.isdigit() and int(i)%2 == 1: odd += i elif i.isdigit() and int(i)%2 == 0: even += i print(lower+upper+odd+even)

  • + 0 comments

    if name == 'main':

    S = input()
    
    def custom_key(Char):
    
        if Char.islower():
            return(0 , Char)
        elif Char.isupper():
            return(1 , Char)
        elif Char.isdigit():
            return (2 if int(Char) % 2 else 3, Char)
    
    
    
    
    
    
    
    sorted_string  = ''.join(sorted(S , key =custom_key))
    
    print(sorted_string)
    
  • + 0 comments

    s = input()

    lowercase = sorted([c for c in s if c.islower()]) uppercase = sorted([c for c in s if c.isupper()]) odd = sorted([c for c in s if c.isdigit() and int(c)%2 !=0]) even = sorted([c for c in s if c.isdigit() and int(c)%2 ==0])

    sorted_s = ''.join(lowercase+uppercase+odd+even) print(sorted_s)

  • + 0 comments

    name = input() sorted_data = ''.join(sorted(name,key=lambda x:( x.isdigit(), x.isdigit() and int(x)%2==0, x.isupper(), x ))) print(sorted_data)

  • + 0 comments
    s.sort()
    
    lowercase = uppercase = odd = even = ""
    
    for letter in s:
        if letter.isnumeric():
            odd += odd.join(letter) if int(letter) % 2 == 0 else ""
            even += even.join(letter) if int(letter) % 2 == 1 else ""
        else:  
            lowercase += lowercase.join(letter) if letter.islower() else ""
            uppercase += uppercase.join(letter) if letter.isupper() else ""
    
    print(lowercase, uppercase, even, odd, sep="")
    

    That's it