6
1
Given this list of all the words in english and a string with s_me missi_g lett__s, find one way to fill in the letters. Do note that some words on the list contain special characters (! & ' , - . /
) and numbers
Input:
This list and a string with missing letters.
The input sentence can contain or be missing any of these characters: ! & ' , - . / 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z
. An underscore is used to mark a missing character. All missing characters have a possible solution.
Output:
One possible solution with all the missing letters fixed. Words split at a space . Case sensitive, includes words with
! & ' , - . /
Test Cases
Input: a string with s_me missi_g lett__s
All possible outputs: a string with [same, seme, sime, some] missing letters
Output Example: a string with same missing letters
Input: A_ 6-po_nt A/_ ada__er
All possible outputs: [A., A1, A4, A5, AA, AB, AF, AG, AH, AI, AY, AJ, AK, AM, AO, AP, AQ, AS, AT, AU, AV, AW, Ax, AZ] 6-point [A/C, A/F, A/O, A/P, A/V]
Output Example: A. 6-point A/C adapter
Input: A_M AT&_ platform_s scyth_'s hee_hee_ he-_e! 2_4,5_t
All possible outputs: [A&M, AAM, ABM, ACM, ADM, AFM, AGM, AIM, ALM, APM, ARM, ASM, ATM, AUM, AVM] AT&T platform's scythe's hee-hee! he-he! 2,4,5.t
Output example: A&M AT&T platform's scythe's hee-hee! he-he! 2,4,5-t
SemicolonSeperatedValue for first possible output:
a string with s_me missi_g lett__s;a string with same missing letters
A_ 6-po_nt A/_ ada__er;A. 6-point A/C adapter
A_M AT&_ platform_s scyth_'s hee_hee_ he-_e! 2_4,5_t;A&M AT&T platform's scythe's hee-hee! he-he! 2,4,5-t
Scoring
As this is code-golf, shortest solution in bytes wins.
1I tried to made this really clear and well defined unlike the other similar questions, what about it is unclear? – pfg – 2018-05-14T18:51:42.687
1@pfg how flexible is the input / output? can we work with a list of the words? – Rod – 2018-05-14T19:11:56.907
3For test case purposes, can we have the 'words' list be
/usr/share/dict/words
instead of something on the web?letters
, for example, is not in the standard unixwords
file (althoughletter
is). That way, on TIO you can use the local file. – Chas Brown – 2018-05-14T19:13:38.800@pfg i meant the 'Words split at a space' part, the input/output can be separated words? Or we need to split / join the space? – Rod – 2018-05-14T19:16:01.550
So for
6-___nt
the only output is6-point
and not the likes of6-saint
etc? – Jonathan Allan – 2018-05-14T19:17:03.777...yet it states "Words split at a space" in the output section and
-
is not a space. – Jonathan Allan – 2018-05-14T19:18:32.130@JonathanAllan Sorry I didn't search the list.
6-point
is the only option for that – pfg – 2018-05-14T19:19:42.8603@pfg: TIO code is running on a virtual unix instance; so in python (for example) I can use
f=open('/usr/share/dict/words');W=f.read()
to access that standard unix file. – Chas Brown – 2018-05-14T19:29:39.247Will any words ever be only underscores? – Οurous – 2018-05-14T22:29:04.720
@Οurous No. Possible special characters are
!&',-./
– pfg – 2018-05-14T22:34:49.863Is it guaranteed that words without underscore are also always in the given word list? – tsh – 2018-05-15T05:10:21.467