Advertisement
sajid161

6:2

Jan 2nd, 2021
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. class Solution
  2. {
  3.     public:
  4.         int countWords(string list[], int n)
  5.         {
  6.           map<string,int>mp;
  7.           for(int i=0;i<n;i++)
  8.            {
  9.              mp[list[i]]++;  
  10.            }
  11.            int count=0;
  12.            for(auto u:mp)
  13.            {
  14.                if(u.second==2) count++;
  15.            }
  16.            return count;
  17.         }
  18.  
  19. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement