-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjava
More file actions
24 lines (22 loc) · 645 Bytes
/
Copy pathjava
File metadata and controls
24 lines (22 loc) · 645 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.company;
import java.util.*;
public class Uiie{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
String str = s, nstr = "";
char ch;
String st = null;
for (int i = 0; i < str.length(); i++) {
ch = str.charAt(i);
nstr = ch + nstr;
st = nstr;
}
// System.out.println("Reversed word: " + nstr);
if (s.equals(st)) {
System.out.println("The word, " + s + ", is a palindrome." );
} else {
System.out.println("no match");
}
}
}