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.
/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. \$\endgroup\$f=open('/usr/share/dict/words');W=f.read()
to access that standard unix file. \$\endgroup\$