Sort by

recency

|

1075 Discussions

|

  • + 0 comments
    x = input()
    lowercase_letters = ''.join(sorted([char for char in x if char.islower()]))
    upper_letters = ''.join(sorted([char for char in x if char.isupper()]))
    odd_digits = ''.join(sorted([char for char in x if char.isdigit() and int(char)%2 != 0]  ))
    even_digits = ''.join(sorted([char for char in x if char.isdigit() and int(char)%2 == 0]  ))
    print( lowercase_letters + upper_letters + odd_digits  + even_digits)
    
  • + 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

    Enter your code here. Read input from STDIN. Print output to STDOUT

    S = str(input())

    upper = '' lower = '' num = ''

    for i in range(len(S)): if S[i].isupper(): upper += S[i] elif S[i].islower(): lower += S[i] else: num += S[i]

    odd = [i for i in num if int(i) % 2 != 0] even = [i for i in num if int(i) % 2 == 0]

    sorted_upper = ''.join(sorted(upper)) sorted_lower = ''.join(sorted(lower)) sorted_odd = ''.join(sorted(odd)) sorted_even = ''.join(sorted(even))

    print(f"{sorted_lower}{sorted_upper}{sorted_odd}{sorted_even}")

  • + 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)