Special case where character preceding the i 'th character is duplicate
if ( counter > 0 ) { i -= counter ; } counter = 0 ; } } return counter < s2 . length ( ) ? - 1 : i - counter ; } public static void main ( String [ ] args ) { String s1 = " geeksfffffoorrfoorforgeeks " ;