Then find the first and last index of given character in the given string
for ( lli i = 0 ; i < s . length ( ) ; i ++ ) { if ( s [ i ] == c ) { for ( lli j = s . length ( ) - 1 ; j > i ; j -- ) if ( s [ j ] == c ) { if ( j == i ) break ;