Skip to content

Commit 6aecf61

Browse files
authored
Merge pull request ashutosh97#69 from chinmay81098/new-branch
New question Added
2 parents 4c129ab + bbe35f6 commit 6aecf61

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

ginortS/Question.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
You are given a string S
2+
S contains alphanumeric characters only.
3+
4+
Your task is to sort the string S in the following manner:
5+
6+
All sorted lowercase letters are ahead of uppercase letters.
7+
All sorted uppercase letters are ahead of digits.
8+
All sorted odd digits are ahead of sorted even digits.
9+
10+
Sample Input
11+
12+
Sorting1234
13+
14+
Sample Output
15+
16+
ginortS1234

ginortS/Solution.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
s=input()
2+
upperCase=[]
3+
lowerCase=[]
4+
even=[]
5+
odd=[]
6+
for i in s:
7+
if i >= 'A' and i<= 'Z':
8+
upperCase.append(i)
9+
elif i >='a' and i<= 'z':
10+
lowerCase.append(i)
11+
elif int(i)%2 == 0:
12+
even.append(i)
13+
elif int(i)%2 != 0:
14+
odd.append(i)
15+
16+
upperCase.sort()
17+
lowerCase.sort()
18+
even.sort()
19+
odd.sort()
20+
21+
print("".join(lowerCase+upperCase+odd+even))

0 commit comments

Comments
 (0)