Advertisement
elephantsarecool

duckduckwhilecin

Jan 18th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <string>
  5. #include <cstdio>
  6. using namespace std;
  7. string star(int n)
  8. {
  9.     string answer;
  10.     while(n--)
  11.         answer+='*';
  12.     return answer;
  13. }
  14. int main()
  15. {
  16.     freopen("input.txt","r",stdin);
  17.     vector <string> k;
  18.     string sentence;
  19.     int quantity;
  20.     cin >> quantity;
  21.     for (int i = 0; i < quantity; ++i)
  22.     {
  23.         string word;
  24.         cin >> word;
  25.         k.push_back(word);
  26.     }
  27.     while(cin>>sentence)
  28.     {
  29.         if(find(k.begin(),k.end(),sentence)!=k.end())cout<<star(sentence.length())<<' ';
  30.         else cout<<sentence<<' ';
  31.     }
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement