Preview:
import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
    public static boolean isPalindrome(String str) {
        if(str.length() == 0 || str.length() == 1)
            return true;
        
        if(str.charAt(0) == str.charAt(str.length() - 1))
            return isPalindrome(str.substring(1, str.length() - 1));
        
        return false;
        
    }
	public static void main (String[] args) throws java.lang.Exception
	{
		System.out.println(isPalindrome("abcba"));

	}
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter