Help me out

doubts

#1

How to know whether a character is present in two different words or not?
Like “o” is present in both words “boy” and “toy”.How will I print it.


#2

You can run a check over the entire length of both the strings and check for the character?


#3

You can make a frequency array and traverse both the strings.

If you encounter - ‘o’ , in the first string,then do a[int(‘o’)-96]++; don’t increment it again.

Now, traverse the second string and do the same thing :slight_smile:

Finally, if a[int(‘o’)-96]==2; then yes, ‘o’ is in both the strings !