Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- using namespace std;
- string star(int n)
- {
- string answer;
- while(--n)
- answer+='*';
- answer+=' ';
- return answer;
- }
- int main()
- {
- vector <string> k;
- string sentence;
- int quantity;
- cin >> quantity;
- for (int i = 0; i < quantity; ++i)
- {
- string word;
- cin >> word;
- word+=' ';
- k.push_back(word);
- }
- cin.ignore();
- getline(cin, sentence);
- sentence+=' ';
- for (int i = 0; i < k.size(); ++i)
- {
- string astgh=star(k[i].length());
- while(sentence.find(k[i])!=string::npos)
- sentence.replace(sentence.find(k[i]),k[i].length(),astgh);
- }
- cout << sentence;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement