Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args){
- //String text = "Madam, I'm Adam!";
- String text = "Hello, World!";
- if (text==null){
- System.out.println("empty");
- return;
- }
- else {
- StringBuilder s = new StringBuilder((text.toLowerCase()).replaceAll("[^A-Za-z1-9]+", ""));
- StringBuilder sr = s.reverse();
- System.out.println(sr);
- System.out.println(s.toString().equals(sr.toString()));
- }
- }
- }
Add Comment
Please, Sign In to add comment