Untitled
unknown
plain_text
a year ago
917 B
5
Indexable
Never
import java.io.*; import java.util.Scanner; public class Main // here declaring the class main { public static boolean isplaindrome(String s) // function isplaindrome is written here { s=s.toLowerCase(); // converting s to lower case String reverse=""; // declaring empty string for(int i=s.length()-1;i>=0;i--) // for loop to iterate from end to start of the string parameter { reverse=reverse+s.charAt(i); // so the characters from the end is added to the reverse string } if(s.equals(reverse)) // if the reverse string is equal to the passed string then return true { return true; // return true } return false; // return false } public static void main(String[] args) { // main method Scanner sc=new Scanner(System.in); // scanner class declaration String s=sc.nextLine(); // asking for the string s System.out.print(isplaindrome(s)); // print the returned boolean } }