title: To check if string is palindrome using recursion?
body: <p>There is something wrong with my code as one the testcase in my assignment is coming out wrong, giving me runtime error when I submit the code online. That testcase could be any String. I believe that everything is fine with the code as I have checked it manually for many testcases. </p>
  
  <p><strong>HERE IS THE CODE</strong></p>
  
  <pre><code>public static boolean isStringPalindrome(String input) {
      if(input.length()==0 || input.length()==1)
          return true;
  
      int first = 0;
      int last = input.length()-1;
  
      if(input.charAt(first) != input.charAt(last))
          return false;
  
      String str="";
      for(int i=first+1;i&lt;last;i++){
          str = str+input.charAt(i); 
      }
      boolean sa = isStringPalindrome(str);
      return sa; 
  }
  </code></pre>
  
  <p><strong>Sample Input</strong></p>
  
  <pre><code>racecar
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>true   
  </code></pre>
  
  <p><strong>Sample Input</strong></p>
  
  <pre><code>pablo
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>false   
  </code></pre>