Sunday, September 30, 2018

How to use python to check if a string is anagram?

Anagram is a word or phrase can be formed by rearranging the letters of another word or phrase. For example, carthorse is anagram of horsecars. Blanks within a phrase will be ignored. orchestra and horse cart are also anagrams.

Write a program that reads a list of phrases and print all pairs of anagram is demonstrated as follow (it will not work for upper case and lower case checking , "A" is different from "a" in the current program):

Sample input: 
carthorse
horse
horse cart
I do not know u
ok i now donut
orchestra
Sample output:
carthorse = horse cart
carthorse = orchestra
horse cart = orchestra
i do not know u = ok i now donut

Please get the code and sample input file as below (there are both python and c++ version): 

Is Anagram Problem

No comments:

Post a Comment

Superior of partial fraction

What is complex fraction? Complex fraction is a fraction whereby its numerator or denominator or both consists of fractions. Partial frac...