Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 830 Bytes

File metadata and controls

34 lines (22 loc) · 830 Bytes

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.