Q6 - anagaram
unknown
java
a year ago
690 B
2
Indexable
Never
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String firstString = scanner.next(); String secondString = scanner.next(); char[] a1Array = firstString.toLowerCase().toCharArray(); char[] a2Array = secondString.toLowerCase().toCharArray(); Arrays.sort(a1Array); Arrays.sort(a2Array); if (Arrays.equals(a1Array, a2Array)) { System.out.println("Both of Strings are anagram"); } else { System.out.println("Both of Strings are not anagram"); } } }