[Challenge] Word in Word. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 13

[Challenge] Word in Word.

Write a program which will accept a line of text and tell you if any of the words appear within any of the other words in the line. Word's length must greater than 1. Here is an example: Input: There is a palm tree on the island. Output: "is" appears in "island" "the" appears in "there" Another example: Input: He is saying hello to his brother. Output: "he" appears in "hello" and "brother" "is" appears in "his" Happy coding!

23rd Jan 2018, 12:39 PM
abdulazizumarovich
abdulazizumarovich - avatar
18 Answers
+ 20
Thank you for nice challenge 😊 Here's my try: https://code.sololearn.com/cxY77z1323FT/?ref=app
23rd Jan 2018, 4:11 PM
LukArToDo
LukArToDo - avatar
23rd Jan 2018, 11:06 PM
Med Arezki
Med Arezki - avatar
+ 8
Here's my attempt, hope it meets the requirements : ) https://code.sololearn.com/cAyYs1995Uz4/?ref=app
24th Jan 2018, 1:57 PM
Ipang
24th Jan 2018, 12:08 PM
Rstar
Rstar - avatar
23rd Jan 2018, 4:22 PM
abdulazizumarovich
abdulazizumarovich - avatar
23rd Jan 2018, 3:27 PM
VcC
VcC - avatar
26th Jan 2018, 6:14 PM
raz
raz - avatar
+ 4
@jonathan you didn't understand the task. you should search words* in words** in given string. both are wodrs* and words** must be inside given string.
23rd Jan 2018, 3:54 PM
abdulazizumarovich
abdulazizumarovich - avatar
+ 4
I have reached lvl 9 with your upvotes. Thank you! All answers are the best.
24th Jan 2018, 4:09 PM
abdulazizumarovich
abdulazizumarovich - avatar
+ 3
@VcC you're right! Sorry, I didn't see
23rd Jan 2018, 1:30 PM
abdulazizumarovich
abdulazizumarovich - avatar
+ 3
@Jonathan Pizarra, is my challenge hard? Need I make it easier?
23rd Jan 2018, 1:42 PM
abdulazizumarovich
abdulazizumarovich - avatar
+ 3
just add "set" and you dont tell when a word is contained twice. see here https://code.sololearn.com/cLo90D3qZ461/?ref=app
24th Jan 2018, 5:37 AM
VcC
VcC - avatar
+ 2
the also appears twice in the first example
23rd Jan 2018, 1:17 PM
VcC
VcC - avatar
+ 2
@HeisAbdulaziz so simple... cool, tnx for challenge
23rd Jan 2018, 4:28 PM
rusich
rusich - avatar
23rd Jan 2018, 5:45 PM
Hiroki Masuda
Hiroki Masuda - avatar
+ 2
сам напиши
23rd Jan 2018, 9:20 PM
Эвгений Левченко
Эвгений Левченко - avatar
+ 2
This is my try that make exactly what the challenge ask, with only one line in output when found multiple values. (I consider wrong all the other codes with multiple line of output for the same word) https://code.sololearn.com/cJzpcyzOQggP/#py
23rd Jan 2018, 11:27 PM
Jamil Mameri
Jamil Mameri - avatar
23rd Jan 2018, 9:45 PM
VcC
VcC - avatar