Sort N Strings - Descending Order

 Coding Problem Keys 

 Sort N Strings - Descending Order 

 Problem Statement 

N strings are passed as input. The program must sort them in the descending order.

 Boundary Condition(s) 

2 <= N <= 15
Length of a string is between 2 and 100.

 Input Format 

The first line contains the value of N.
Next N lines contain the value of N string values.

 Output Format 

N lines containing the N string values sorted in descending order.

 Example Input/Output 1 

 Input 

6
Apple
banana
Boy
Zoo
Hat
heckle

 Output 

heckle
banana
Zoo
Hat
Boy
Apple

 Note: Max Execution Time Limit: 5000 millisecs 

 Solution 

 Programming Language: Python 3 Language 

n=int(input())
l=sorted([input().strip() for i in range(n)])[::-1]
for i in l:
    print(i)

# Published By PKJCODERS

 (Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.) 

Comments

Popular Posts

Next Multiple of X after N

Sum - Remove Last Occurring Zero

Maximum LCM of Adjacent Pair

Four Integers

Array Frequency Equals Value

Swap First & Third Parts - Nth Character