June 09, 2022 |1.5K Views

    Count words that appear exactly two times in an array of words

      Share   Like
    Description
    Discussion

    Given an array of n words. Some words are repeated twice, we need to count such words.

    Examples:

    Input : s[] = {"hate", "love", "peace", "love", 
                  "peace", "hate", "love", "peace", 
                  "love", "peace"};
    Output : 1
    There is only one word "hate" that appears twice

     

    Count words that appear exactly two times in an array of words: https://www.geeksforgeeks.org/count-words-appear-exactly-two-times-array-words/