Topic Portal
Test instructions: To two string s,t, you can insert the character C (different from the previous one) after the S string, asking if you can convert s to t string
Construction: First lens > Lent or s[1]! = t[1] must be no, then t the same length of the first part of the same character in S to the same, otherwise it cannot be inserted, after the part as long as the same part all exist, the different parts can be arbitrarily inserted
/************************************************
* 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 + ;
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]) re Turn 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;
}
Construct Hdoj 5414 CRB and String