Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- string str;
- char m;
- getline(cin, str);
- cout << "Enter symbol: ";
- cin >> m;
- unsigned i, j;
- int count = -1;
- for (i = 0; i < str.length(); i++)
- {
- count++;
- if (str[i] == ';' || str[i] == '!' || str[i] == ' ' || str[i] == ',' || str[i] == '.')
- {
- if ((tolower(str[i - count])) == m && (tolower(str[i - 1] == m)))
- {
- for (j = i - count; j <= i - 1; j++)
- cout << str[j];
- cout << endl;
- }
- count = -1;
- }
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement