您的位置:首页 > 其它

uva 10340 All in All

2013-08-28 08:37 295 查看
题意:蛮水的一道题,只要看串a的字符是否依次出现过串b就行了

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN = 100005;

char a[MAXN],b[MAXN];

int main()
{
    while (cin>>a>>b)
    {
        int cur = 0;
        int len_a = strlen(a),len_b = strlen(b);

        for (int i = 0; i < len_b; i++)
        {
            if (cur == len_a)
                break;
            else if (a[cur] == b[i])
                cur++;
        }
        if (cur == len_a)
            cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: