codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <iostream> #include <sstream> #include <string> #include <map> using namespace std; int main() { string s, d; s = "v1 v1 v2 v2 v2 v3"; stringstream tmp; tmp << s; map <string,int> M; while (tmp >> d) ++M[d]; int max = -1; for (map <string,int> :: iterator it = M.begin(); it != M.end(); ++it) max = (max > it->second) ? (max) : (it->second); cout << max << endl; return 0; }
Private
[
?
]
Run code
Submit