<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import java.util.*;

public class Palindrome{
	public static void main( String[] args ){
		Scanner input = new Scanner( System.in );
		
		System.out.print( "Enter a string: " );
		String str = input.nextLine();
		
		int low = 0;
		int high = str.length() - 1;
		
		boolean isPalindrome = true;
		while( low &lt; high ){
			if( str.charAt( low ) != str.charAt( high ) ){
				isPalindrome = false;
				break;
			}
			low++;
			high--;
		}
		
		System.out.println( "The string " + str + " is " + ( ( isPalindrome == true ) ? "" : "not " ) + "a palindrome" );
	}
}</pre></body></html>