c++ - expected primary-expression before ‘.’ token in ordered_map() -


i want insert paragraph or article content , process each word. below trying each string , occurance of it. want word max occurance. new c++. right have inserted statically 2 strings. gives error expected primary-expression before ‘.’ token. code below: `

#include <string> #include <iostream> #include <unordered_map>  int main() {     typedef std::unordered_map<std::string,int> occurrences;     occurrences s1;     s1.insert(std::pair<std::string,int>("hello",1));     s1.insert(std::pair<std::string,int>("hellos",2));      //for ( auto = occurrences.begin(); != occurrences.end(); ++it )  gives same + additional " error: unable deduce ‘auto’ ‘<expression error>’" error     (std::unordered_map<std::string, int>::iterator = occurrences.begin();//error here                                                     != occurrences.end(); ////error here                                                     ++it)     {         std::cout << "words :" << it->first << "occured" << it->second <<  "times";     }      return 0; } 

where mistake?

occurrences type, not object. want use object s1.

version 1:

for (auto = s1.begin(); != s1.end(); ++it) 

version 2:

for (std::unordered_map<std::string, int>::iterator = s1.begin(); != s1.end(); ++it) 

version 3:

for (auto pair : s1)