(No, né questo né nessuno di questi )
Data una stringa e un elenco di stringhe, riempire tutti gli spazi vuoti nella stringa di input con le stringhe corrispondenti.
Input Output
La stringa di input contiene solo caratteri alfabetici, spazi e caratteri di sottolineatura. È non vuoto e non inizia con un carattere di sottolineatura. In altre parole, la stringa di input corrisponde alla regex^[a-z A-Z]([a-z A-Z_]*[a-z A-Z])?$
Ogni stringa nell'elenco di input non è vuota e contiene solo caratteri e spazi alfanumerici. In altre parole, corrispondono alla regex ^[a-z A-Z]+$.
Uno spazio vuoto è una sequenza contigua di caratteri di sottolineatura ( _) che non è né preceduta né preceduta da un carattere di sottolineatura.
La stringa di input contiene nspazi vuoti per un numero intero positivo ne l'elenco di stringhe contiene esattamente nstringhe.
L'output si ottiene sostituendo ogni k-th blank nella stringa di input con la k-th stringa nell'elenco di input delle stringhe.
Esempio
Data una stringa di input "I like _____ because _______ _____ing"e un elenco di stringhe ["ice cream", "it is", "satisfy"], possiamo trovare l'output come segue:
- Il primo spazio vuoto viene subito dopo
"like ". Lo riempiamo con"ice cream"per ottenere"I like ice cream because ______ _____ing". - Il secondo spazio vuoto viene subito dopo
"because ". Lo riempiamo con"it is"per ottenere"I like ice cream because it is _____ing". - Il terzo vuoto viene subito dopo
"is ". Lo riempiamo con"satisfy"per ottenere"I like ice cream because it is satisfying".
Abbiamo emesso la stringa finale "I like ice cream because it is satisfying".
Casi test
input string, input list => output
"Things _____ for those who ____ of how things work out _ Wooden",["work out best","make the best","John"] => "Things work out best for those who make the best of how things work out John Wooden"
"I like _____ because _______ _____ing",["ice cream","it is","satisfy"] => "I like ice cream because it is satisfying"
"If you are ___ willing to risk _____ you will ha_o settle for the ordi_____Jim ______n",["not","the usual","ve t","nary ","Roh"] => "If you are not willing to risk the usual you will have to settle for the ordinary Jim Rohn"
"S____ is walking from ____ to ____ with n_oss of ___ W_____ Churchill",["uccess","failure","failure","o l","enthusiasm","inston"] => "Success is walking from failure to failure with no loss of enthusiasm Winston Churchill"
"If_everyone_is_thinking ____ ____ somebody_isnt_thinking G____e P____n",[" "," "," ","alike","then"," "," ","eorg","atto"] => "If everyone is thinking alike then somebody isnt thinking George Patton"
"Pe_________e __say ____motivation does__ last Well___her doe_ bathing____thats why we rec____nd it daily _ __________lar",["opl","often ","that ","nt"," neit","s"," ","omme","Zig","Zig"] => "People often say that motivation doesnt last Well neither does bathing thats why we recommend it daily Zig Ziglar"