https://vjudge.net/problem/UVA-10340

题意:

输入字符串s和t,问是否能从t中删除0个或多个字符得到s。

思路:

略。。。

代码:

 1 #include <iostream>
 2 #include <string>
 3 using namespace std;
 4 
 5 int main()
 6 {
 7     string a,b;
 8 
 9     while (cin >> a >> b)
10     {
11         int i = 0;
12         int j = 0;
13 
14         while (j < b.length())
15         {
16             if (a[i] == b[j])
17             {
18                 i++;
19                 j++;
20             }
21             else
22                 j++;
23 
24             if (i >= a.length()) break;
25         }
26 
27         if (i == a.length()) cout << "Yes\n";
28         else cout << "No\n";
29     }
30 
31     return 0;
32 }

 

相关文章:

  • 2021-10-17
  • 2021-12-03
  • 2022-12-23
  • 2021-07-28
  • 2021-08-23
  • 2022-12-23
  • 2021-11-25
  • 2021-08-12
猜你喜欢
  • 2021-12-13
  • 2022-02-28
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
相关资源
相似解决方案