INSTAGRAM : / javac_programming
CODE :
import java.util.Queue;
import java.util.Scanner;
import java.util.LinkedList;
class PalindromeTest {
public static void main(String[] args) {
System.out.print("Enter any string:");
Scanner in=new Scanner(System.in);
String inputString = in.nextLine();
Queue queue = new LinkedList();
for (int i = inputString.length()-1; i _=0; i--) {
queue.add(inputString.charAt(i));
}
String reverseString = "";
while (!queue.isEmpty()) {
reverseString = reverseString+queue.remove();
}
if (inputString.equals(reverseString))
System.out.println("The input String is a palindrome.");
else
System.out.println("The input String is not a palindrome.");
}
}
Output 1:
Enter any string:xyzzyx
xyzzyx
The input String is a palindrome.
Output 2:
Enter any string:xyz
The input String is not a palindrome.
En esta página del sitio puede ver el video en línea java program to check palindrome string using Queue de Duración hora minuto segunda en buena calidad , que subió el usuario Aman Tripathi 23 mayo 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 195 veces y le gustó 6 a los espectadores. Disfruta viendo!