Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <sstream>
- using namespace std;
- int main()
- {
- string text, word;
- cout << "Enter text: " << endl;
- getline(cin, text);
- stringstream words(text);
- while (words >> word)
- {
- int c = 1;
- int t = 1;
- if (word.find_first_of(text) != string::npos)
- {
- cout << word << endl;
- for (int i = 0; i < word.length(); i++) {
- if (word[0] == word[i + 1]) {
- c++;
- t = c;
- }
- }
- cout << t;
- cout << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement