(Tidak, bukan ini atau semua ini )
Diberikan string dan daftar string, isi semua kosong di string input dengan string yang sesuai.
Input output
String input hanya berisi karakter alfabet, spasi, dan garis bawah. Ini kosong dan tidak dimulai dengan garis bawah. Dengan kata lain, string input cocok dengan regex^[a-z A-Z]([a-z A-Z_]*[a-z A-Z])?$
Setiap string dalam daftar input adalah kosong dan hanya berisi karakter dan spasi alfanumerik. Dengan kata lain, mereka cocok dengan regex ^[a-z A-Z]+$
.
Kosong adalah urutan garis bawah ( _
) yang berdekatan yang tidak didahului atau diproses oleh garis bawah.
String input berisi n
kosong untuk beberapa bilangan bulat positif n
, dan daftar string berisi n
string yang tepat .
Output diperoleh dengan mengganti masing-masing k
blank-in dalam string input dengan k
string -th dalam daftar input string.
Contoh
Diberikan string input "I like _____ because _______ _____ing"
dan daftar string ["ice cream", "it is", "satisfy"]
, kita dapat menemukan output sebagai berikut:
- Blank pertama langsung muncul setelahnya
"like "
. Kami mengisinya dengan"ice cream"
untuk mendapatkan"I like ice cream because ______ _____ing"
. - Blank kedua langsung muncul setelahnya
"because "
. Kami mengisinya dengan"it is"
untuk mendapatkan"I like ice cream because it is _____ing"
. - Kosong ketiga datang langsung setelahnya
"is "
. Kami mengisinya dengan"satisfy"
untuk mendapatkan"I like ice cream because it is satisfying"
.
Kami mengeluarkan string terakhir "I like ice cream because it is satisfying"
.
Uji Kasus
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"