Config String Parser
Configs are often stored as one compact string, with key-value pairs separated by delimiters. Given a string s in a format like a=1;b=2;c=3, return a dictionary with string keys and string values. Ignore empty segments. If the same key appears more than once, keep the last value.
Примеры
Ввод
"a=1;b=2;c=3"Вывод
{"a": "1", "b": "2", "c": "3"}Ввод
""Вывод
{}Ввод
"x=10;;y=20"Вывод
{"x": "10", "y": "20"}Нужно реализовать
def parse_config(s):
Теги
stringsdicthashmap
Kirjaudu sisään nähdäksesi palautushistorian
Kirjaudu sisäänKirjaudu sisään käyttääksesi tekoälymentoria
Kirjaudu sisäänTests12
Visible tests
Piilotettu testi 7
Piilotettu testi 8
Piilotettu testi 9
Piilotettu testi 10
Piilotettu testi 11
Piilotettu testi 12
They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.
Focus radio
Paused · SomaFM · Fluid