Give two strings S and t//for the string s can be any one character C in S, followed by D (d!=c)//Q s can be converted to t//meet two conditions//1: For s in all characters t have// 2: The first character of S and T is the same and the number of consecutive s is greater than or equal to t#include<cstdio> #include <cstring> #include <iostream>using namespace std; const int MAXN = 1E5+10; char STR1[MAXN], STR2[MAXN]; int main () {//Freopen ("In.txt", "R", stdin); int t; scanf ("%d", &t); while (t--) {scanf ("%s%s", str1, str2); int len1 = strlen (STR1); int len2 = strlen (STR2); int t1 = 0, t2 = 0; BOOL flag = FALSE; while (str1[t1] = = str1[t1+1]) t1++; while (str2[t2] = = str2[t2+1]) t2++; if (str1[0]! = str2[0] | | T1 < t2) flag = true; T1 = 0, t2 = 0; while (T1 < len1 && T2 < len2) {while (str2[t2]! = Str1[t1]) if (t2 + 1 > Len2 {flag = true; break;} else t2++; t1++, t2++; } if (T1 < len1 && T2 > Len2) flag = true; if (!flag) puts ("Yes"); Else puts ("No"); } return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
HDU5414CRB and String Simulation