Returns true if first and last characters of s are same .
int checkEquality ( string s ) { return ( s [ 0 ] == s [ s . size ( ) - 1 ] ) ; } int countSubstringWithEqualEnds ( string s ) { int result = 0 ; int n = s . length ( ) ;