#3084

Count Substrings Starting and Ending with Given Character

specialist · 880 · lc medium +31 · 49.9% accepted · 148 likes · top 37%

Description

Given a string s and a character c, return how many substrings of s have c as both their first and last character.

Code

1
2
3