Checking strings against each other (Anagrams)

后端 未结 23 1877
忘了有多久
忘了有多久 2020-11-30 10:55

The assignment is to write a program that accepts two groups of words from the user and then prints a \"True\" statement if the two are anagrams (or at least if all the lett

23条回答
  •  北海茫月
    2020-11-30 11:11

    Java Code for Anagram

    static void anagram(String s1,String s2){
        if(s1.length()!=s2.length()){
            System.out.println("not anagram");
            return;
        }
        else{
            int []arr=new int[256];
    
            int size=s1.length();
            for(int i=0;i

提交回复
热议问题