Post History
The Universal Crossword has a set of guidelines for crossword puzzle submissions. In this challenge we are going to be concerned with their rules for hidden word themes. A hidden word clue consis...
#3: Post edited
- [The Universal Crossword](https://www.puzzlesociety.com/crosswords) has a set of [guidelines](https://docs.google.com/document/d/1ORNpKwGG7RedypfnYwgOfkTUc0jNZ7FKRRTVWDmTfl8/edit) for crossword puzzle submissions.
- In this challenge we are going to be concerned with their rules for hidden word themes. A hidden word clue consists of a clue and a word. It can either be a
- "word break" or a "bookend".
- For a word break the word must not appear as a contiguous substring of the clue, but if all the spaces are removed from the clue, then it is a contiguous substring with a non-empty prefix and suffix. Some examples:
- * `POOR HOUSE`, `RHO`: is valid. Solution: <code>POO<b><i>R HO</i></b>USE</code>
- * `IMPROPER USE`, `PERUSE`: is not valid. It appears separated by a space: <code>IMPRO<b><i>PER USE</i></b></code>, but the suffix is empty.
- * `SINGLE TRACK`, `SINGLET`: is not valid. It appears separated by a space: <code><b><i>SINGLE T</i></b>RACK</code>, but the prefix is empty.
- * `PLANE TICKET`, `ET`: is not valid. The word appears separated by a space: <code>PLAN<b><i>E T</i></b>ICKET</code>, but it also appears contiguously: <code>PLANE TICK<b><i>ET</i></b></code>.
For a bookend the word must appear as a combination of a prefix and a suffix of the clue, but is not a contiguous subtring. Bookends may span word breaks, but are not required to. The clue must not appear as a contiguous substring to be a valid bookend.- * `SINGLE TRACK`, `SICK`: is valid. Solution: <code><b><i>SI</i></b>NGLE TRA<b><i>CK</i></b></code>
- * `YOU MUST DOT YOUR IS AND CROSS YOUR TS`, `YURTS`: is valid. Solution: <code><b><i>Y</i></b>OU MUST DOT YOUR IS AND CROSS YO<b><i>UR TS</i></b></code>
- * `STAND CLEAR`, `STAR`: is valid, even though there are two solutions: <code><b><i>STA</i></b>ND CLEA<b><i>R</i></b></code> and <code><b><i>ST</i></b>AND CLE<b><i>AR</i></b></code>
- * `START A WAR`, `STAR`: is not valid since the word is a prefix of the clue.
- * `TWO BIRDS WITH TWO STONE`, `TONE`: is not valid since the word is a suffix of the clue
- You will take as input a word (consisting of letters `A`-`Z`) and a clue (consisting of letters `A`-`Z` and spaces) and you must determine if the word is a valid solution to the clue by the above rules.
- If the input is a valid pair you must output one consistent value, if it is not you must output a distinct consistent value.
This is [tag:code-golf] so the goal is to minimize the size of your source code as measured in bytes.- ## Test cases
- Valid:
- ```text
- POOR HOUSE, RHO
- SINGLE TRACK, SICK
- YOU MUST DOT YOUR IS AND CROSS YOUR TS, YURTS
- STAND CLEAR, STAR
- ```
- Invalid:
- ```text
- IMPROPER USE, PERUSE
- SINGLE TRACK, SINGLET
- PLANE TICKET, ET
- START A WAR, STAR
- TWO BIRDS WITH ONE STONE, TONE
- ```
- [The Universal Crossword](https://www.puzzlesociety.com/crosswords) has a set of [guidelines](https://docs.google.com/document/d/1ORNpKwGG7RedypfnYwgOfkTUc0jNZ7FKRRTVWDmTfl8/edit) for crossword puzzle submissions.
- In this challenge we are going to be concerned with their rules for hidden word themes. A hidden word clue consists of a clue and a word. It can either be a
- "word break" or a "bookend".
- For a word break the word must not appear as a contiguous substring of the clue, but if all the spaces are removed from the clue, then it is a contiguous substring with a non-empty prefix and suffix. Some examples:
- * `POOR HOUSE`, `RHO`: is valid. Solution: <code>POO<b><i>R HO</i></b>USE</code>
- * `IMPROPER USE`, `PERUSE`: is not valid. It appears separated by a space: <code>IMPRO<b><i>PER USE</i></b></code>, but the suffix is empty.
- * `SINGLE TRACK`, `SINGLET`: is not valid. It appears separated by a space: <code><b><i>SINGLE T</i></b>RACK</code>, but the prefix is empty.
- * `PLANE TICKET`, `ET`: is not valid. The word appears separated by a space: <code>PLAN<b><i>E T</i></b>ICKET</code>, but it also appears contiguously: <code>PLANE TICK<b><i>ET</i></b></code>.
- For a bookend the word must appear as a combination of a non-empty prefix and a non-empty suffix of the clue, but is not a contiguous substring. Bookends may span word breaks, but are not required to. The clue must not appear as a contiguous substring to be a valid bookend.
- * `SINGLE TRACK`, `SICK`: is valid. Solution: <code><b><i>SI</i></b>NGLE TRA<b><i>CK</i></b></code>
- * `YOU MUST DOT YOUR IS AND CROSS YOUR TS`, `YURTS`: is valid. Solution: <code><b><i>Y</i></b>OU MUST DOT YOUR IS AND CROSS YO<b><i>UR TS</i></b></code>
- * `STAND CLEAR`, `STAR`: is valid, even though there are two solutions: <code><b><i>STA</i></b>ND CLEA<b><i>R</i></b></code> and <code><b><i>ST</i></b>AND CLE<b><i>AR</i></b></code>
- * `START A WAR`, `STAR`: is not valid since the word is a prefix of the clue.
- * `TO ME`, `TOME`: is valid. It can be split multiple ways including ways with empty prefixes and suffixes.
- * `TWO BIRDS WITH TWO STONE`, `TONE`: is not valid since the word is a suffix of the clue
- * `IMPROPER USE`, `PERUSE`: is not valid. It appears as a suffix and is not a contiguous substring: <code>IMPRO<b><i>PER USE</i></b></code>, but the prefix needs to be non empty for a bookend.
- You will take as input a word (consisting of letters `A`-`Z`) and a clue (consisting of letters `A`-`Z` and spaces) and you must determine if the word is a valid solution to the clue by the above rules.
- If the input is a valid pair you must output one consistent value, if it is not you must output a distinct consistent value.
- This is code golf so the goal is to minimize the size of your source code as measured in bytes.
- ## Test cases
- Valid:
- ```text
- POOR HOUSE, RHO
- SINGLE TRACK, SICK
- YOU MUST DOT YOUR IS AND CROSS YOUR TS, YURTS
- STAND CLEAR, STAR
- TO ME, TOME
- IN A PICKLE, NAP
- ```
- Invalid:
- ```text
- IMPROPER USE, PERUSE
- SINGLE TRACK, SINGLET
- PLANE TICKET, ET
- START A WAR, STAR
- TWO BIRDS WITH ONE STONE, TONE
- ```
#2: Post edited
- [The Universal Crossword](https://www.puzzlesociety.com/crosswords) has a set of [guidelines](https://docs.google.com/document/d/1ORNpKwGG7RedypfnYwgOfkTUc0jNZ7FKRRTVWDmTfl8/edit) for crossword puzzle submissions.
- In this challenge we are going to be concerned with their rules for hidden word themes. A hidden word clue consists of a clue and a word. It can either be a
- "word break" or a "bookend".
- For a word break the word must not appear as a contiguous substring of the clue, but if all the spaces are removed from the clue, then it is a contiguous substring with a non-empty prefix and suffix. Some examples:
- * `POOR HOUSE`, `RHO`: is valid. Solution: <code>POO<b><i>R HO</i></b>USE</code>
- * `IMPROPER USE`, `PERUSE`: is not valid. It appears separated by a space: <code>IMPRO<b><i>PER USE</i></b></code>, but the suffix is empty.
- * `SINGLE TRACK`, `SINGLET`: is not valid. It appears separated by a space: <code><b><i>SINGLE T</i></b>RACK</code>, but the prefix is empty.
- * `PLANE TICKET`, `ET`: is not valid. The word appears separated by a space: <code>PLAN<b><i>E T</i></b>ICKET</code>, but it also appears contiguously: <code>PLANE TICK<b><i>ET</i></b></code>.
- For a bookend the word must appear as a combination of a prefix and a suffix of the clue, but is not a contiguous subtring. Bookends may span word breaks, but are not required to. The clue must not appear as a contiguous substring to be a valid bookend.
- * `SINGLE TRACK`, `SICK`: is valid. Solution: <code><b><i>SI</i></b>NGLE TRA<b><i>CK</i></b></code>
- * `YOU MUST DOT YOUR IS AND CROSS YOUR TS`, `YURTS`: is valid. Solution: <code><b><i>Y</i></b>OU MUST DOT YOUR IS AND CROSS YO<b><i>UR TS</i></b></code>
- * `STAND CLEAR`, `STAR`: is valid, even though there are two solutions: <code><b><i>STA</i></b>ND CLEA<b><i>R</i></b></code> and <code><b><i>ST</i></b>AND CLE<b><i>AR</i></b></code>
- * `START A WAR`, `STAR`: is not valid since the word is a prefix of the clue.
- * `TWO BIRDS WITH TWO STONE`, `TONE`: is not valid since the word is a suffix of the clue
- You will take as input a word (consisting of letters `A`-`Z`) and a clue (consisting of letters `A`-`Z` and spaces) and you must determine if the word is a valid solution to the clue by the above rules.
- If the input is a valid pair you must output one consistent value, if it is not you must output a distinct consistent value.
- This is [tag:code-golf] so the goal is to minimize the size of your source code as measured in bytes.
- ## Test cases
- Valid:
```- POOR HOUSE, RHO
- SINGLE TRACK, SICK
- YOU MUST DOT YOUR IS AND CROSS YOUR TS, YURTS
- STAND CLEAR, STAR
- ```
- Invalid:
```- IMPROPER USE, PERUSE
- SINGLE TRACK, SINGLET
- PLANE TICKET, ET
- START A WAR, STAR
- TWO BIRDS WITH ONE STONE, TONE
- ```
- [The Universal Crossword](https://www.puzzlesociety.com/crosswords) has a set of [guidelines](https://docs.google.com/document/d/1ORNpKwGG7RedypfnYwgOfkTUc0jNZ7FKRRTVWDmTfl8/edit) for crossword puzzle submissions.
- In this challenge we are going to be concerned with their rules for hidden word themes. A hidden word clue consists of a clue and a word. It can either be a
- "word break" or a "bookend".
- For a word break the word must not appear as a contiguous substring of the clue, but if all the spaces are removed from the clue, then it is a contiguous substring with a non-empty prefix and suffix. Some examples:
- * `POOR HOUSE`, `RHO`: is valid. Solution: <code>POO<b><i>R HO</i></b>USE</code>
- * `IMPROPER USE`, `PERUSE`: is not valid. It appears separated by a space: <code>IMPRO<b><i>PER USE</i></b></code>, but the suffix is empty.
- * `SINGLE TRACK`, `SINGLET`: is not valid. It appears separated by a space: <code><b><i>SINGLE T</i></b>RACK</code>, but the prefix is empty.
- * `PLANE TICKET`, `ET`: is not valid. The word appears separated by a space: <code>PLAN<b><i>E T</i></b>ICKET</code>, but it also appears contiguously: <code>PLANE TICK<b><i>ET</i></b></code>.
- For a bookend the word must appear as a combination of a prefix and a suffix of the clue, but is not a contiguous subtring. Bookends may span word breaks, but are not required to. The clue must not appear as a contiguous substring to be a valid bookend.
- * `SINGLE TRACK`, `SICK`: is valid. Solution: <code><b><i>SI</i></b>NGLE TRA<b><i>CK</i></b></code>
- * `YOU MUST DOT YOUR IS AND CROSS YOUR TS`, `YURTS`: is valid. Solution: <code><b><i>Y</i></b>OU MUST DOT YOUR IS AND CROSS YO<b><i>UR TS</i></b></code>
- * `STAND CLEAR`, `STAR`: is valid, even though there are two solutions: <code><b><i>STA</i></b>ND CLEA<b><i>R</i></b></code> and <code><b><i>ST</i></b>AND CLE<b><i>AR</i></b></code>
- * `START A WAR`, `STAR`: is not valid since the word is a prefix of the clue.
- * `TWO BIRDS WITH TWO STONE`, `TONE`: is not valid since the word is a suffix of the clue
- You will take as input a word (consisting of letters `A`-`Z`) and a clue (consisting of letters `A`-`Z` and spaces) and you must determine if the word is a valid solution to the clue by the above rules.
- If the input is a valid pair you must output one consistent value, if it is not you must output a distinct consistent value.
- This is [tag:code-golf] so the goal is to minimize the size of your source code as measured in bytes.
- ## Test cases
- Valid:
- ```text
- POOR HOUSE, RHO
- SINGLE TRACK, SICK
- YOU MUST DOT YOUR IS AND CROSS YOUR TS, YURTS
- STAND CLEAR, STAR
- ```
- Invalid:
- ```text
- IMPROPER USE, PERUSE
- SINGLE TRACK, SINGLET
- PLANE TICKET, ET
- START A WAR, STAR
- TWO BIRDS WITH ONE STONE, TONE
- ```
#1: Initial revision
Is it a valid hidden word?
[The Universal Crossword](https://www.puzzlesociety.com/crosswords) has a set of [guidelines](https://docs.google.com/document/d/1ORNpKwGG7RedypfnYwgOfkTUc0jNZ7FKRRTVWDmTfl8/edit) for crossword puzzle submissions. In this challenge we are going to be concerned with their rules for hidden word themes. A hidden word clue consists of a clue and a word. It can either be a "word break" or a "bookend". For a word break the word must not appear as a contiguous substring of the clue, but if all the spaces are removed from the clue, then it is a contiguous substring with a non-empty prefix and suffix. Some examples: * `POOR HOUSE`, `RHO`: is valid. Solution: <code>POO<b><i>R HO</i></b>USE</code> * `IMPROPER USE`, `PERUSE`: is not valid. It appears separated by a space: <code>IMPRO<b><i>PER USE</i></b></code>, but the suffix is empty. * `SINGLE TRACK`, `SINGLET`: is not valid. It appears separated by a space: <code><b><i>SINGLE T</i></b>RACK</code>, but the prefix is empty. * `PLANE TICKET`, `ET`: is not valid. The word appears separated by a space: <code>PLAN<b><i>E T</i></b>ICKET</code>, but it also appears contiguously: <code>PLANE TICK<b><i>ET</i></b></code>. For a bookend the word must appear as a combination of a prefix and a suffix of the clue, but is not a contiguous subtring. Bookends may span word breaks, but are not required to. The clue must not appear as a contiguous substring to be a valid bookend. * `SINGLE TRACK`, `SICK`: is valid. Solution: <code><b><i>SI</i></b>NGLE TRA<b><i>CK</i></b></code> * `YOU MUST DOT YOUR IS AND CROSS YOUR TS`, `YURTS`: is valid. Solution: <code><b><i>Y</i></b>OU MUST DOT YOUR IS AND CROSS YO<b><i>UR TS</i></b></code> * `STAND CLEAR`, `STAR`: is valid, even though there are two solutions: <code><b><i>STA</i></b>ND CLEA<b><i>R</i></b></code> and <code><b><i>ST</i></b>AND CLE<b><i>AR</i></b></code> * `START A WAR`, `STAR`: is not valid since the word is a prefix of the clue. * `TWO BIRDS WITH TWO STONE`, `TONE`: is not valid since the word is a suffix of the clue You will take as input a word (consisting of letters `A`-`Z`) and a clue (consisting of letters `A`-`Z` and spaces) and you must determine if the word is a valid solution to the clue by the above rules. If the input is a valid pair you must output one consistent value, if it is not you must output a distinct consistent value. This is [tag:code-golf] so the goal is to minimize the size of your source code as measured in bytes. ## Test cases Valid: ``` POOR HOUSE, RHO SINGLE TRACK, SICK YOU MUST DOT YOUR IS AND CROSS YOUR TS, YURTS STAND CLEAR, STAR ``` Invalid: ``` IMPROPER USE, PERUSE SINGLE TRACK, SINGLET PLANE TICKET, ET START A WAR, STAR TWO BIRDS WITH ONE STONE, TONE ```