Even and Odd Strings

Published by Werdna in

Given a one word lowercase string $s, return another string such that even-indexed and odd-indexed characters are grouped and groups are space-separated.

Examples

evenOddString("mubashir") ➞ "mbsi uahr"
// Letters at even indexes = "mbsi"
// Letters at odd indexes = "uahr"
// Join both strings with a space

evenOddString("edabit") ➞ "eai dbt"

evenOddString("airforce") ➞ "aroc ifre"

Notes

There will be no space in the given string.

Watch a quick demo on how Edabit works.