#include<iostream>
#include<unordered_map>
#include<string>
using namespace std;
void printdub(string st)
{
unordered_map <char, int> mp;
for(int i=0; i<st.length(); i++)
{
mp[st[i]]++;
}
for(auto it : mp)
{
if(it.second>1)
{
cout<<it.first<<", total_count="<<it.second<<endl;
}
}
}
int main()
{
string st;
cin>>st;
printdub(st);
return 0;
}
/*
geeksofgeeks
s, total_count=2
k, total_count=2
e, total_count=4
g, total_count=2
*/
/*
The first argument states how many times
The second argument the CHAR you want to repeat. No strings allowed
*/
std::string(5, '.') + "yourString"
Code Example |
---|
Cpp :: factorial loop c++ |
Cpp :: c++ hashmaps |
Cpp :: std vector random shuffle |
Cpp :: chudnovsky algorithm c++ |
Cpp :: function in c++ |
Cpp :: what is - in c++ |
Cpp :: vector to string cpp |
Cpp :: c++ namespace |
Cpp :: Sort html elements in Jquery on condition |
Cpp :: c++ print out workds |
Cpp :: c include |
Cpp :: cpp while |
Cpp :: no template named vector in namespace std |
Cpp :: ascii cpp |
Cpp :: how to delete an element in vector pair in cpp |
Cpp :: set to vector |
Cpp :: accumulate() in c++ |
Cpp :: c++ access second last element of vector |
Cpp :: c++ get whole line |
Cpp :: hashmap c++ |
Cpp :: c++ inheritance |
Cpp :: calculator in cpp |
Cpp :: how to declare a vector of int in c++ |
Cpp :: initialise 2d vector in c++ |
Cpp :: hello world cc++ |
Cpp :: cmake g++ address sanitizer |
Cpp :: c++ check that const char* has suffix |
Cpp :: opengl draw house using glut c++ |
Cpp :: c++ queue |
Cpp :: clear map in C++ |