Repeating Letters

Published by Николай in

Create a function that takes a string and returns a string in which each character is repeated once.

Examples

DoubleChar("String") ➞ "SSttrriinngg"

DoubleChar("Hello World!") ➞ "HHeelllloo  WWoorrlldd!!"

DoubleChar("1234!_ ") ➞ "11223344!!__  "

Notes

All test cases contain valid strings. Don't worry about spaces, special characters or numbers. They're all considered valid characters.

Watch a quick demo on how Edabit works.