[Community Puzzle] Fix the spaces

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @Rafarafa,validated by @_O-MEGA,@cedricdd and @Timinator.
If you have any issues, feel free to ping them.

1 Like

This is so disappointing - why is there not VB.NET as a coding language?

You can choose VB.NET in the combo box…it is the last entry.

Thanks, but I was referring to last night’s challenge.

This topic has nothing to do with the yesterday challenge.

1 Like

Reposting here from the contribution page.

Added two tests, 9 (Actually solvable) and 10 (Actually solvable 2). 9 is mainly for helping to debug and shouldn’t affect anyone’s code, 10’s though may potentially break some. Here’s test 10:

ABCABABC
AB ABC CAB

Expected solution
AB CAB ABC

I saw a very interesting python solution that was only checking two sets of possible prefixes at each iteration (sort of 2 depth search) while passing every test. That wasn’t intended and it should fail now (probably can pass with a 3 depth search but yeah…).

If your code doesn’t work anymore I’m sorry.

1 Like

Still works for me

It’s harder than most easy puzzles. I needed to work hard on the task.
Added: Forgetting to say the main thing - great puzzle!

1 Like

Anybody had problems on Test 08?
It states it should be Unsolvable, but with original string being “starstarstar” and the words given “stars tar star”, it should be solvable, right?
I’m outputting “star stars tar” but no luck.

Given that there is more than one possible solution, the expected output is “Unsolvable”, based on the instruction in the statement:

there are some cases where the original sentence can not unambiguously be deciphered. In those cases print Unsolvable.

Arg… I’m stuck with tests 11 and 12

I am solving all test cases and all validators with no backtracking or guessing, only logic. Even in the above example, there is only one place CAB can go. Once that is put in its place, there is only one place ABC can go and then only one place for AB. If no logical placements are available, I assume unsolvable. I haven’t given it much thought but I am wondering if it is possible to have a situation where logic breaks down, but the puzzle is still solveable.

1 Like

AABABA
A AB ABA

Expected solution
A AB ABA

Should I add it and break more people’s code :smile:

On a side note it wasn’t easy to find.

Why do you think this test would break code, the point is to have multiple positions for each words? The test Repeated is already checking that no?

I think this one would break my code, I’ll output “Unsolvable”.

Because :
there is only 1 word “A” and 3 possible positions,
there is only 1 word “AB” and 2 possible positions,
there is only 1 word "“ABA” and 2 possible positions.

So I can’t solve the problem.

I ended up adding test 11 (Actually solvable 3… lol). It should prevent some solutions based on cleverly deducing the positions of the words. You can see the discussion some messages above this one. The test is:

AABABA
A AB ABA

Expected solution
A AB ABA

Sorry to @Timinator, @Remi and every one else whose code broke this time. In my defense this puzzle went through 3 iterations and 3+ months in the contribution section and no one remarked those deficiencies…

I believe @Rafarafa is mostly referring to code such as mine that uses logic only, no backtracking. And, yes, just like @Remi suggested, my code is saying “unsolvable” for this new test case. However, I hope @Rafarafa is already working on even tougher test cases because I think I know how I’m going to add logic to handle this new test case. I refuse to use backtracking for this puzzle until I am forced to…mostly just because I enjoy the logic. :grin:

Logically, ‘AB’ and ‘ABA’ have no way of covering the very first ‘A’, so the standalone ‘A’ must cover the 1st ‘A’. Then, there is only one option remaining for the ‘AB’ and one option for the ‘ABA’. I did not think of this either in my original code.

I’ll find a new logic (or not, the puzzle is still finished for me :smile: ) but I don’t think this puzzle should stay easy now.