Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <map>
- #include <iostream>
- using namespace std;
- int main() {
- std::string word = "This is the ultimate C++ advice that Lord Hakobyan and Graf Mher will give you. Just remember a simple thing: “using namespace std;” bad. This advice should be followed throughout this entire module, otherwise we will be sad.";
- std::map<char, int> charCount;
- for (unsigned int i = 0; i < word.size(); i += 1) {
- if(word[i] != ' ')
- charCount[word[i]] += 1;
- }
- for (std::map<char, int>::iterator it = charCount.begin(); it != charCount.end(); it++) {
- if (it->second >= 10) {
- std::cout << it->first << ": " << it->second << std::endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement