Professional Documents
Culture Documents
Untitled
Untitled
*;
import java.util.Scanner;
public class testcode{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.println("enter the first word");
String str1 = sc.next();
System.out.println("enter the second number");
String str2 = sc.next();
str1 = str1.toLowerCase();
str2 = str2.toLowerCase();
if(str1.length() == str2.length()){
char[] st1 = str1.toCharArray();
char[] st2 = str2.toCharArray();
Arrays.sort(st1);
Arrays.sort(st2);
if(res){
System.out.println("the given words are anagrams");
}else{
System.out.println("the given word are not anagrams");
}
}else{
System.out.println("the given words are not anagrams");
}
}
}