12345678910111213141516171819202122232425
#include<iostream> #include<map> using namespace std; int main() { char inpArr[] = {'a','b','c','a','c','b','d','a','a','a'}; map <char, int> myMap; for (int i=0; i<sizeof(inpArr); i++) { if (myMap.count(inpArr[i]) == 0) { myMap.insert(pair<char, int>(inpArr[i],1)); } else { myMap[inpArr[i]]++; } } map <char, int>::iterator it; for (it = myMap.begin(); it!=myMap.end(); it++) { if ((*it).second >= 5) { cout<<(*it).first<<endl; } return 0; }