Short Around Long

This function helps you practice comparing string lengths and joining strings in the right order. Write a function combo_string that takes two strings a and b of different lengths. Find the shorter string and return the result in this pattern: short, then long, then short again.

Примеры

Ввод
"Hello", "hi"
Вывод
"hiHellohi"
Ввод
"hi", "Hello"
Вывод
"hiHellohi"
Ввод
"aaa", "b"
Вывод
"baaab"

Нужно реализовать

def combo_string(a: str, b: str) -> str:

Теги

strings
PostgreSQLv16

Hier erscheint das Ergebnis der Codeausführung

Visible tests
1
Input
"Hello", "hi"
Expected"hiHellohi"
2
Input
"hi", "Hello"
Expected"hiHellohi"
3
Input
"aaa", "b"
Expected"baaab"
4
Input
"", "bb"
Expected"bb"
5
Input
"aaa!", "b"
Expected"baaa!b"
6
Input
"hi", "HELLO"
Expected"hiHELLOhi"
Focus radio
Paused · SomaFM · Fluid