Returns true if first and last characters of s are same .
< ? php function checkEquality ( $ s ) { return ( $ s [ 0 ] == $ s [ strlen ( $ s ) - 1 ] ) ; } function countSubstringWithEqualEnds ( $ s ) { $ result = 0 ; $ n = strlen ( $ s ) ;