Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.lang.*;
- import java.io.*;
- public class Main {
- public static void main(String[] args) throws java.lang.Exception {
- // youwhiler code here
- Scanner sc = new Scanner(System.in);
- String s = sc.nextLine();
- s = s.toLowerCase();
- int n = s.length();
- int count = 0;
- int i = 0;
- int j = n - 1;
- while (i < j) {
- // System.out.println(s.charAt(i) + " " + s.charAt(j));
- if ((s.charAt(i) >= 'a' && s.charAt(i) <= 'z') && (s.charAt(j) >= 'a' && s.charAt(j) <= 'z')) {
- if (s.charAt(i) != s.charAt(j)) {
- count++;
- break;
- }
- i++;
- j--;
- } else if (s.charAt(i) < 'a' || s.charAt(i) > 'z') {
- i++;
- } else if (s.charAt(j) < 'a' || s.charAt(j) > 'z') {
- j--;
- }
- }
- if (count == 0)
- System.out.print(1);
- else
- System.out.print(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement