+ 7

[Challenge] Sorting words.

Write a program that accepts a sequence of whitespace separated words. Remove all duplicate words and remove non-letter marks before or after words(not middle). Sort them alphanumerically. Input example: Hello world and practice makes perfect!!! And hello world again. Then, the output should be: again and hello makes perfect practice world Built in sorting functions are not allowed!

12th Jan 2018, 3:39 PM
abdulazizumarovich
abdulazizumarovich - avatar
9 Respostas
12th Jan 2018, 9:41 PM
LukArToDo
LukArToDo - avatar
12th Jan 2018, 4:27 PM
Chief Commander
Chief Commander - avatar
+ 3
Fun one! Done in Ruby using a binary search tree, just used a couple builtins to cleanup the input string first. https://code.sololearn.com/c84D06k6JdCf Just updated to simplify the code a bit more and add relevant comments
12th Jan 2018, 5:58 PM
Simon
Simon - avatar
12th Jan 2018, 4:30 PM
Sebastián Zapata
Sebastián Zapata - avatar
+ 1
Sorry! Built in sorting functions are not allowed!
12th Jan 2018, 4:41 PM
abdulazizumarovich
abdulazizumarovich - avatar
+ 1
I didn't read that jajaja, I'll try again
12th Jan 2018, 4:41 PM
Sebastián Zapata
Sebastián Zapata - avatar
12th Jan 2018, 6:30 PM
abdulazizumarovich
abdulazizumarovich - avatar
0
Fixed! :)
12th Jan 2018, 4:49 PM
Sebastián Zapata
Sebastián Zapata - avatar
12th Jan 2018, 4:21 PM
NAGANDLA.LEELA PAVAN KUMAR
NAGANDLA.LEELA PAVAN KUMAR - avatar