0% found this document useful (0 votes)
323 views

Alpha Numeric Sorting

Given a text with words and numbers, the document describes a problem to sort the words and numbers in ascending order and print them alternating between words and numbers. The input consists of test cases with texts separated by space. The output prints the sorted words in lowercase and numbers with words preceding numbers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
323 views

Alpha Numeric Sorting

Given a text with words and numbers, the document describes a problem to sort the words and numbers in ascending order and print them alternating between words and numbers. The input consists of test cases with texts separated by space. The output prints the sorted words in lowercase and numbers with words preceding numbers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

TCS CodeVita 2015 Round 2 :

Problem : Alpha Numeric Sorting


Given text comprising of words and numbers, sort them both in ascending order and print them in a
manner that a word is followed by a number. Words can be in upper or lower case. You have to convert
them into lowercase and then sort and print them.
Input Format:
First line contains total number of test cases, denoted by N
Next N lines, each contains a text in which words are at odd position and numbers are at even position
and are delimited by space
Output Format:
Words and numbers sorted in ascending order and printed in a manner that a word is followed by a
number.
Constraints:
1. Text starts with a word
2. Count of words and numbers are the same.
3. Duplicate elements are not allowed
4. Words should be printed in lower case.
5. No special characters allowed in text.

Sample Input and Output

SNo.Input
1

2
Sagar 35 sanjay 12 ganesH 53 ramesh 19
Ganesh 59 suresh 19 rakesh 26 laliT 96

Output
ganesh 12 ramesh 19 sagar 35 sanjay 53
ganesh 19 lalit 26 rakesh 59 suresh 96

You might also like