Given two strings s1 and s2, check if both the strings are anagrams of each other.
Input : s1 = "listen" s2 = "silent" Output : The strings are anagrams. Input : s1 = "dad" s2 = "bad" Output : The strings aren't anagrams.
Python provides a inbuilt function sorted() which does not modify the original string, but returns sorted string.
Below is the Python implementation of the above approach:
The strings are anagrams.
- Check whether two strings are anagram of each other
- Using Counter() in Python to find minimum character removal to make two strings anagram
- Python Dictionary | Check if binary representations of two numbers are anagram
- Longest common anagram subsequence from N strings
- Python | Check if list is sorted or not
- Remove minimum number of characters so that two strings become anagram
- Minimum Number of Manipulations required to make two Strings Anagram Without Deletion of Character
- Search in an array of strings where non-empty strings are sorted
- Check if any anagram of a string is palindrome or not
- Check if binary representations of two numbers are anagram
- Check if binary representation of a given number and its complement are anagram
- Anagram checking in Python using collections.Counter()
- Number of sub-strings which are anagram of any sub-string of another string
- heapq in Python to print all elements in sorted order from row and column wise sorted matrix
- Meta Strings (Check if two strings can become same after a swap in one string)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.