Take the subString from i to j and call the function with subString and the given character
int len = j + 1 - i ; char [ ] tmp = new char [ len ] ; Array . Copy ( s , i , tmp , 0 , len ) ; ans = solve ( tmp , c ) ; break ; } break ; } } }