You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.;
public class Solution {
public static void main(String[] args) { Scanner obj=new Scanner(System.in); String s=obj.nextLine(); String t=obj.nextLine(); String s1=s.toLowerCase(); String t1=t.toLowerCase(); boolean anagram=true; if(s1.length()!=t1.length()){ anagram=false; } char []s2=s1.toCharArray(); char []t2=t1.toCharArray(); Arrays.sort(s2); Arrays.sort(t2); if(Arrays.equals(s2,t2)==false){ System.out.print("Not Anagrams"); } else System.out.print("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 →
import java.io.; import java.util.;
public class Solution {
}