UVa10340 All in All

#include <iostream>
#include <string>
using namespace std;

int main()
{
    string s, t;
    string::size_type p, q;
    while (cin >> s >> t)
    {
        p = 0;
        for (string::const_iterator it = s.begin(); it != s.end(); ++it)
        {
            q = t.find_first_of(*it, p);
            if (q == string::npos)
                break;
            p = q + 1;
        }

        if (q != string::npos)
            cout << "Yes\n";
        else
            cout << "No\n";
    }

    return 0;
}

posted on 2015-06-23 04:11  danny1221  阅读(354)  评论(-1编辑  收藏  举报

导航