You are viewing a single comment's thread. Return to all comments →
I did like this Found it more simly to transform it into a char array sort it and compare:
import java.io.; import java.util.;
public class Solution {
public static void main(String[] args) { Scanner in = new Scanner(System.in); String a = in.nextLine().toLowerCase(); String b = in.nextLine().toLowerCase(); in.close(); char[] arrayA = a.toCharArray(); char[] arrayB = b.toCharArray(); Arrays.sort(arrayA); Arrays.sort(arrayB); if(Arrays.equals(arrayA, arrayB)){ 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 →
I did like this Found it more simly to transform it into a char array sort it and compare:
import java.io.; import java.util.;
public class Solution {
}