int counter = 0 ; pointing s2
import java . io . * ; class GFG { public static int Substr ( String s2 , String s1 ) { int i = 0 ; for ( ; i < s1 . length ( ) ; i ++ ) { if ( counter == s2 . length ( ) ) break ; if ( s2 . charAt ( counter ) == s1 . charAt ( i ) ) { counter ++ ; } else {