Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
October 19, 2020 01:45 pm GMT

Daily Challenge 297 - Loneliest Character

Your task is to write a function loneliest() which accepts a string and will return the character that has the most spaces to its right and left.

Examples

'a b c' => ['b']
'a bcs d k' => ['d']
' a b sc p t k' => ['p']
'a b c de' => ['b', 'c']
' a b c de ' => ['b']
'abc' => ['a', 'b', 'c']

Tests

loneliest('abc d ef g h i j ')
loneliest('abc')
loneliest(' abc d z f gk s ')

Good luck!

This challenge comes from aplefull on CodeWars. Thank you to CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!

Want to propose a challenge idea for a future post? Email [email protected] with your suggestions!


Original Link: https://dev.to/thepracticaldev/daily-challenge-297-loneliest-character-3akp

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To