Duplicate Characters

This transformation is a good way to practice walking through a string and building new text. Write a function double_char that takes a string s and returns a new string where every character is repeated twice in a row. Repeat everything: letters, spaces, hyphens, and any other characters.

Примеры

Ввод
"The"
Вывод
"TThhee"
Ввод
"AAbb"
Вывод
"AAAAbbbb"
Ввод
"Hi-There"
Вывод
"HHii--TThheerree"

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

def double_char(s: str) -> str:

Теги

strings
PostgreSQLv16

Hier verschijnt het resultaat van je code

Visible tests
1
Input
"The"
Expected"TThhee"
2
Input
"AAbb"
Expected"AAAAbbbb"
3
Input
"Hi-There"
Expected"HHii--TThheerree"
4
Input
""
Expected""
5
Input
"a"
Expected"aa"
6
Input
" "
Expected" "
Focus radio
Paused · SomaFM · Fluid