zoukankan      html  css  js  c++  java
  • poj 1936 All in All

    Description

    You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss in detail how the strings are generated and inserted into the original message. To validate your method, however, it is necessary to write a program that checks if the message is really encoded in the final string.

    Given two strings s and t, you have to decide whether s is a subsequence of t, i.e. if you can remove characters from t such that the concatenation of the remaining characters is s.

    Input

    The input contains several testcases. Each is specified by two strings s, t of alphanumeric ASCII characters separated by whitespace.The length of s and t will no more than 100000.

    Output

    For each test case output "Yes", if s is a subsequence of t,otherwise output "No".

    Sample Input

    sequence subsequence
    person compression
    VERDI vivaVittorioEmanueleReDiItalia
    caseDoesMatter CaseDoesMatter
    

    Sample Output

    Yes
    No
    Yes
    No
    
     1 #include<stdio.h>
     2 #include<string.h>
     3 #define MAX 100005
     4 char str1[MAX],str2[MAX];
     5 int main()
     6 {
     7     int i,j;
     8     int len1,len2;
     9     while(~scanf("%s %s",str1,str2))
    10     {
    11         len1=strlen(str1);
    12         len2=strlen(str2);
    13         j=0;
    14         for(i=0;i<len2;i++)
    15         {
    16             if(str2[i]==str1[j])j++;
    17         }
    18         if(j==len1)printf("Yes
    ");
    19         else printf("No
    ");
    20     }return 0;
    21 }
  • 相关阅读:
    github教程
    Django订单接入支付宝
    python去除html标签的几种方法
    vue-cli项目生成
    restful设计规范
    Vue的指令系统、计算属性和表单输入绑定
    Vue工具
    药物不良反应数据库信息的下载
    爬虫案例之Pubmed数据库下载
    数据分析案例之39药品网
  • 原文地址:https://www.cnblogs.com/wlc297984368/p/3267152.html
Copyright © 2011-2022 走看看