HDU5414CRB and String Simulation

Source: Internet
Author: User



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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.