#include <iostream>
#include <map>
#include <sstream>
int main() {
std::string inputString = "knight kevin once said that maybe that kind of process is necessary to him pushing him on and on and it is very painful he knows.";
std::istringstream s(inputString);
//this map maps the char to their respective count
std::map<char, int> charCount;
std::string word;
int count = 0;//this count the total number of words
while(s >> word)
{
charCount[word[0]]++;
count++;
}
std::cout<<"Total number of words are:"<<count<<" out of which"<<std::endl;
for(std::pair<char, int> pairElement: charCount)
{
std::cout<<pairElement.second<<" starts with: "<<pairElement.first<<std::endl;
}
return 0;
}