Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include<iostream>
  2. #include<algorithm>
  3. #include<string>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. string str1, str2;
  10. while (cin >> str1 >> str2)
  11. {
  12. bool error;
  13. int mark = 0;
  14. for (int i = 0; i < str1.size(); i++)
  15. {
  16. error = 1;
  17. for (int j = mark; j < str2.size(); j++)
  18. {
  19. if (str1[i] == str2[j])
  20. {
  21. mark = j+1; error = false; break;
  22. }
  23.  
  24. }
  25. if (error) {
  26. cout << "No\n";
  27. break;
  28. }
  29. }
  30. if (!error) cout << "Yes\n";
  31. }
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement