You are viewing a single comment's thread. Return to all comments →
Scanner scan = new Scanner(System.in); char[] first = scan.next().toLowerCase().toCharArray(); char[] second = scan.next().toLowerCase().toCharArray(); Arrays.sort(first); Arrays.sort(second); if (Arrays.equals(first, second)) { System.out.println("Anagrams"); } else { System.out.println("Not Anagrams"); }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Anagrams
You are viewing a single comment's thread. Return to all comments →