标签:
/************************************************ * Author :Running_Time * Created Time :2015-8-20 15:29:43 * File Name :I.cpp ************************************************/ #include <cstdio> #include <algorithm> #include <iostream> #include <sstream> #include <cstring> #include <cmath> #include <string> #include <vector> #include <queue> #include <deque> #include <stack> #include <list> #include <map> #include <set> #include <bitset> #include <cstdlib> #include <ctime> using namespace std; #define lson l, mid, rt << 1 #define rson mid + 1, r, rt << 1 | 1 typedef long long ll; const int MAXN = 1e5 + 10; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; char s[MAXN], t[MAXN]; bool judge(void) { int lens = strlen (s + 1); int lent = strlen (t + 1); if (lens > lent || s[1] != t[1]) return false; int i, j; for (j=2; j<=lent; ++j) { if (t[j] != t[1]) break; } for (i=1; i<j; ++i) { if (s[i] != t[i]) return false; } while (i <= lens) { while (j <= lent && s[i] != t[j]) ++j; if (j > lent) return false; i++; j++; } return true; } int main(void) { //HDOJ 5414 CRB and String int T; scanf ("%d", &T); while (T--) { scanf ("%s%s", s + 1, t + 1); puts (judge () ? "Yes" : "No"); } return 0; }
标签:
原文地址:http://www.cnblogs.com/Running-Time/p/4747499.html