Skip to content

Files

Latest commit

 

History

History
This branch is 1 commit ahead of, 5 commits behind igorwojda/kotlin-coding-challenges:main.

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jul 20, 2023
Feb 7, 2023
Feb 7, 2023

Surrounded letter

Instructions

Given a string containing letters and + characters implement a function which determines if each letter in the string is surrounded by + character. There may be more than one + character between letters (+a++b+) and letters may be surrounded by the same + character (+a+b+).

Challenge | Solution

Examples

surroundedLetter("+a+") // true

surroundedLetter("+ab+") // false

surroundedLetter("+a+b+") // true

surroundedLetter("+a++b++") // true

Hints

Hint 1 Use can use regex to determine number of available patterns (plus character ; letter ; plus character) in the string.
Hint 2 You can also get number of available letters in the string.