Why i am getting index out of bound exception here
@Narasimha,
https://ide.codingblocks.com/s/224834 corrected code
add a return statement to your base case. And, add an โelseโ after the if(str.charAt(si)==โxโ) block, that way you will avoid all the unnecessary calls .