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
- Check whether two Strings are Anagram of each other using HashMap in Java
- 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
- Remove minimum number of characters so that two strings become anagram
- Python | Check if list is sorted or not
- 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
- Python | Check if substring is part of List of Strings
- Check if binary representations of two numbers are anagram
- Check if binary representation of a given number and its complement are anagram
- Number of sub-strings which are anagram of any sub-string of another string
- Anagram checking in Python using collections.Counter()
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.