Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <iterator>
  4. #include <vector>
  5. #include <fstream>
  6. #include <iomanip>
  7. #include <string>
  8. #include <cstdint>
  9.  
  10. #define PR(x) std::cout << (x) << std::endl;
  11.  
  12.  
  13. int main(int argc, char* argv[])
  14. {
  15. unsigned long int count = 0;
  16. std::string string1;
  17. std::string pattern;
  18. std::string temp;
  19. std::vector<std::string> vec;
  20.  
  21. scanf("%ld\n", &count);
  22. for (int i = 0; i < count; ++i) {
  23. std::getline(std::cin, string1);
  24. std::getline(std::cin, pattern);
  25.  
  26. std::cout << string1 << std::endl;
  27. std::cout << pattern << std::endl << std::endl;
  28.  
  29. for (char& el : string1) {
  30. if (el != '.') {
  31. temp += el;
  32. } else {
  33. vec.push_back(temp);
  34. temp.clear();
  35. }
  36. }
  37. vec.push_back(temp);
  38.  
  39. for (auto&& it : vec) {
  40. pattern.erase(0, (it).size());
  41.  
  42. if (pattern.size() == 0) {
  43. PR("YES")
  44. break;
  45. }
  46. }
  47.  
  48. if (pattern.size() != 0) {
  49. PR("NO")
  50. }
  51.  
  52. temp.clear();
  53. vec.clear();
  54. }
  55.  
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement