Thursday 6 August 2020

Checking if two strings are Anagram

Problem:

 

Objective: To Check whether two strings are Anagrams or Not.

What are Anagram strings?

The strings which constitutes of the same letters but arranged in different order are called as Anagrams.

Example: Silent and Listen are Anagrams since both contain the same letters {I,E,L,S,T}.

Input Format:

First two lines takes the two strings to check for.

Gets is used although it is not advised to use gets() since it can cause Buffer Overflow. But since it is a simple program we have neglected that.

We have used vector for this program.

Vector are nothing but kind of dynamic arrays.

We daclare a vector as

“vector<string> s11,s22; ”

Here s11 and s22 are vector strings

Sample Code:


Previous Post
Next Post