#include <iostream>
#include <map>
using namespace std;
int main()
{
string text = { "hello my name is paperman" }; // наш текст
string word = { "" }; // слово для сравнения
cin >> word; // просим ввести сравниваемую букву
map<char, unsigned> key_map;
for(auto i: text) {
if (word.find(tolower(i)) != string::npos) {
++key_map[tolower(i)] ;
}
}
for(auto &pair : key_map) {
cout << "char: " << pair.first << " | count: " << pair.second << endl ;
}
return 0;
}
1. 1)6 2)3 3)6 4)11 5)13 6)8
2. 1, 2, 6, 8
3. 1, 2, 3, 5, 6, 8
4. 2, 8
5. 1, 2, 3, 4, 5, 6, 8
В любых
случаях и условиях