Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

66%
+2 −0
Challenges Is it a valid hidden word?

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

1 answer  ·  posted 1y ago by WheatWizard‭  ·  last activity 1y ago by Razetime‭

#3: Post edited by user avatar WheatWizard‭ · 2023-10-21T14:38:26Z (about 1 year ago)
Update.
  • [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 by user avatar WheatWizard‭ · 2023-10-20T18:27:22Z (about 1 year ago)
Code formatting.
  • [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 by user avatar WheatWizard‭ · 2023-10-20T18:26:52Z (about 1 year ago)
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
```