[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.