+ 2

Attempt this one with python code

Problem Statement: Need to process an input string, accepted from STDIN. and find only all the numeric tokens that are present in the string. Consider tokens to be sequence of printable characters separated by space(s). (In numeric tokens all characters are digits) You need to build a new string which is of the form numeric_token1 numeric_token2 print this in ascending order. (A single space is the separator) (If no numeric tokens are found you need to print NONE FOUND) Input : We need to read a line from STDIN to extract the numeric tokens only Output : The string composed of number1 number2 in ascending order . Or NONE FOUND Test Cases: Input: hello hi 123 789 45 hi Output: 45 123 789 Input: 20 abc beg 90 67 Output: 20 67 90 Input: hi hello foo bar foo Output: NONE FOUND My attempt in python language https://code.sololearn.com/c46CVAEThQzk/?ref=app

28th Sep 2021, 4:58 AM
Manoj Kumar T
Manoj Kumar T - avatar
9 Answers
28th Sep 2021, 5:13 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
https://code.sololearn.com/caoO4y8I1VMY/?ref=app
28th Sep 2021, 8:47 AM
Oma Falk
Oma Falk - avatar
+ 2
Your code is working fine , but you have to include the header "stdio.h" before using printf() function
28th Sep 2021, 5:10 AM
Rishi
Rishi - avatar
28th Sep 2021, 4:28 PM
Vitaly Sokol
Vitaly Sokol - avatar
+ 1
Hi Manoj Interesting challenge but posted in the wrong place. Q&A is for coding related questions only, not challenges. The best place to post a challenges is in your personal feed, or on a post which I will link here for you.
28th Sep 2021, 5:10 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Python solution txt = input() li = txt.split(" ") nli = [] for pos, i in enumerate(li): if i.isdigit(): nli.append(i) nli.sort() out = "" if len(nli) == 0: print("Not found") else: for i in nli: if pos != len(nli) - 1: out += i +" " else: out += i print(out)
28th Sep 2021, 5:23 AM
Erlénio.RS
Erlénio.RS - avatar
+ 1
Welcome to the Challenge section. Have a look at the previous challenges to see the format. Somehow you have managed to post your entire Q&A here, not to worry. My attempt attached https://code.sololearn.com/c4rRVEUB834Y/?ref=app
28th Sep 2021, 8:41 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
text = list(input().split()) lstNumber=[] for i in text: if i.isdigit(): lstNumber.append(int(i)) if len(lstNumber)!=0: lstNumber.sort() for i in lstNumber: print(i,end=' ') else: print ('not found')
28th Sep 2021, 9:35 AM
Hemmat
Hemmat - avatar
0
For this I/p - fac tsh sh ish It's not working
28th Sep 2021, 9:13 AM
Manoj Kumar T
Manoj Kumar T - avatar