+ 4

Condense strings challenge

I came up with the idea of this challenge online and I thought I could post it here. User inputs a sentence (string), each word separated with a space. The program outputs a new string with the words condensed. Now what does condensing mean? If you take two words, and the ending of the first one is the same as the beggining of the second one, they are merged together into a new word. Examples: Input: "Live verses" Output: "Liverses" Input: "No one ever runs so often" Output: "Noneverunsoften" Enjoy!

24th Jul 2017, 10:41 PM
Augustas Macijauskas
Augustas Macijauskas - avatar
13 Answers
+ 6
If the string contains duplicated strings adjacently placed? Ex: "string string"
25th Jul 2017, 12:05 AM
J.G.
J.G. - avatar
25th Jul 2017, 11:26 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
25th Jul 2017, 9:12 AM
Ekansh
+ 4
@Augustas No, good explanation but Im french. https://code.sololearn.com/c9PofK7MaaGJ/?ref=app
25th Jul 2017, 11:34 AM
clement
clement - avatar
+ 3
@clement Once more it isn't perfect: if I input "live verses", it outputed the same thing, "live verses", when it should be "liverses"
25th Jul 2017, 10:28 AM
Augustas Macijauskas
Augustas Macijauskas - avatar
+ 2
Also check out my own Tic Tac Toe game: https://code.sololearn.com/WtKc34f0gtbz/?ref=app Best of luck coders!
24th Jul 2017, 10:42 PM
Augustas Macijauskas
Augustas Macijauskas - avatar
25th Jul 2017, 8:21 AM
clement
clement - avatar
+ 2
@Ekansh kashyap Nope, read the rules: if the ending of one word is the same as the beggining of the second one, the ending of the first word is deleted and then the two words are merged together
25th Jul 2017, 10:24 AM
Augustas Macijauskas
Augustas Macijauskas - avatar
+ 2
@clement Congratulations, we have a winner, just tested it, everything works just fine :)
25th Jul 2017, 11:52 AM
Augustas Macijauskas
Augustas Macijauskas - avatar
+ 1
@J.G. One of them gets deleted
25th Jul 2017, 7:23 AM
Augustas Macijauskas
Augustas Macijauskas - avatar
+ 1
@clement Nice try, but it isn't yet perfect ;) My input was no one ever runs so often, and output was none everuns soften, when it should be noneverunsoften. Good luck improving it
25th Jul 2017, 8:30 AM
Augustas Macijauskas
Augustas Macijauskas - avatar
+ 1
@clement Yeah, my explanation wasn't so good too :/
25th Jul 2017, 10:36 AM
Augustas Macijauskas
Augustas Macijauskas - avatar
0
@/* S Vengat */ Haha, it's a good start though :)
26th Jul 2017, 10:02 AM
Augustas Macijauskas
Augustas Macijauskas - avatar