Write a program that, given a string of capital letters, output all possible phrases that could have been written originally, using any variant of the Oxford English Dictionary.


There are two inputs:

  • A string \$s\$ of A-Z capital letters that is a phrase with certain letters removed. Example: THSSANEAMPLE
  • Another string \$r\$ of the letters that have been removed from said phrase. Example: IX. These letters are in no particular order.


Output all phrases shorter than twice the length of \$s\$ which, after removing letters in \$r\$, result in \$s\$. Separate words in each phrase by spaces.


  • You are allowed to access any webpage you want, as long as it was created before this question was originally asked. If this webpage was changed in order to facilitate this challenge, then this is likewise not acceptable.
  • Slang or names of places or people are not required.
  • Disregard whether a phrase would be syntactically or grammatically correct.
  • Assume that any full word containing only omitted letters is not to be included.


"MITURE","X" should only have one possibility.

"MN", "DAI" should give you "MAN", but need not give "ADMIN", "MIND", or "DAMN" because they're at least twice as long as "MN".

closed as unclear what you're asking by lirtosiast, Kirill L., Quintec, Jo King, fəˈnɛtɪk Dec 5 at 21:13

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 8
    I would recommend providing a specific dictionary for the programs to use. Otherwise different programs could end up working with different specifications. – fəˈnɛtɪk Dec 5 at 20:15
  • 1
    "You are allowed to access any website you want, as long as it was created before this question was originally asked" - This still leaves the possibility of a website being created before this challenge, but updated afterwards. Also websites can change, breaking answers that were previously working. It's up to you what to allow, but allowing accessing websites can make it more difficult to write the spec in a robust way. If you're interested in alternative approaches, one way would be to specify a dictionary file and say "you may access this file" rather than a website. – trichoplax Dec 5 at 20:44
  • 2
    It is also reasonable to specify that the answer can use any dictionary, as long as an arbitrary different dictionary can be substituted in the same number of bytes to load it, such as by taking the dictionary as a third parameter or loading it from a file. – Sparr Dec 5 at 20:52
  • 1
    I found 160 possible solutions to your example. You might want to add an example with fewer solutions so that you can give people some input output pairs to test with. Solution: (this) (is/six) (an/((a/ax) nix)) (example/(exam pile/(pi (lie/lex)))/(ex ample/(amp (lie/lex))/(am/aim/((a/ax) mix) (pile/(pi (lie/lex))) – fəˈnɛtɪk Dec 5 at 22:16
  • 2
    What constitutes slang? – Post Left Garf Hunter Dec 6 at 0:45

Browse other questions tagged or ask your own question.