Sort by

recency

|

1066 Discussions

|

  • + 0 comments
    import re
    string=input()
    lc=re.findall(r'[a-z]',string)
    uc=re.findall(r'[A-Z]',string)
    num=re.findall(r'[0-9]',string)
    od=[ i for i in num if int(i)%2!=0]
    ev=[ i for i in num if int(i)%2==0]
    print(*sorted(lc),*sorted(uc),*sorted(od),*sorted(ev),sep="")
    
  • + 0 comments
    string1 = list(str(input()))
    listx = list()
    [listx.append(i) for i in sorted(string1) if(i.islower())]
    [listx.append(i) for i in sorted(string1) if(i.isupper())]
    [listx.append(i) for i in sorted(string1) if( i.isdigit() and int(i)%2 != 0 )]
    [listx.append(i) for i in sorted(string1) if( i.isdigit() and int(i)%2 == 0 )]
    print("".join(listx))
    
  • + 0 comments

    p = input() low = sorted([x for x in p if x.islower()]) uper = sorted([x for x in p if x.isupper()]) di = sorted([x for x in p if x.isdigit()]) digit = sorted([x for x in di if x.isdigit()], key=lambda x : int(x)%2 == 0) print("".join(low + uper + digit))

  • + 0 comments
    string = input()
    sorted_lowercase = ''
    sorted_uppercase = ''
    sorted_odd = ''
    sorted_even = ''
    
    string = sorted(string)
    for char in string:
        if char.islower():
            sorted_lowercase += char
        elif char.isupper():
            sorted_uppercase += char
    
        if char.isdigit() and int(char) % 2 is not 0:
            sorted_odd += char
        elif char.isdigit() and int(char) % 2 == 0:
            sorted_even += char
        
    
    print(sorted_lowercase + sorted_uppercase + sorted_odd + sorted_even)
    
  • + 1 comment
    num_odd,num_even,low,cap="","","","" 
    for i in range(len(s)):
        if s[i].lower() == s[i]:
            if s[i].isdigit():
                if int(s[i]) % 2:
                    num_odd += (s[i]) 
                else:
                    num_even += (s[i]) 
            else:
                low += s[i]
        else:
            cap += s[i]
    s = low+cap+str(num_odd)+str(num_even)
    print(s)