anagram python
def isAnagram(A,B):
if sorted(A) == sorted(B):
print("Yes")
else:
print("No")
isAnagram("earth","heart") #Output: Yes
#Hope this helps:)
anagram python
def isAnagram(A,B):
if sorted(A) == sorted(B):
print("Yes")
else:
print("No")
isAnagram("earth","heart") #Output: Yes
#Hope this helps:)
anagram
#take user input
String1 = input('Enter the 1st string :')
String2 = input('Enter the 2nd string :')
#check if length matches
if len(String1) != len(String2):
#if False
print('Strings are not anagram')
else:
#sorted function sort string by characters
String1 = sorted(String1)
String2 = sorted(String2)
#check if now strings matches
if String1 == String2:
#if True
print('Strings are anagram')
else:
print('Strings are not anagram')
Anagram
const anagram = (str1, str2) => {
return str1.toLowerCase().split('').sort().join('') === str2.toLowerCase().split('').sort().join('');
};
let test = anagram('Regallager', 'Lagerregal');
console.log(test);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us