Skip to content

Conversation

@A-Kayode
Copy link
Collaborator

Counting Anagrams

Have the function CountingAnagrams(str) take the str parameter and determine how many anagrams exist in the string. An anagram is a new word that is produced from rearranging the characters in a different word, for example: cars and arcs are anagrams. Your program should determine how many anagrams exist in a given string and return the total number. For example: if str is "aa aa odg dog gdo" then your program should return 2 because "dog" and "gdo" are anagrams of "odg". The word "aa" occurs twice in the string but it isn't an anagram because it is the same word just repeated. The string will contain only spaces and lowercase letters, no punctuation, numbers, or uppercase letters.

Examples
Input: "aa aa odg dog gdo"
Output: 2

Input: "a c b c run urn urn"
Output: 1

@A-Kayode A-Kayode requested a review from CaduceusInc November 18, 2022 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants