All in All
Time Limit: 1000MS
Memory Limit: 30000K
Total Submissions: 27537
Accepted: 11274

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

Source

Ulm Local 2002

水一个。

。。

就是推断字符串st1是不是字符串st2的字串。

#include <iostream>
using namespace std;
int main()
{
char st1[100000],st2[100000];
__int64 l1,l2,i,j;
while(cin>>st1>>st2)
{ i=0;j=0;
l1=strlen(st1);
l2=strlen(st2);
while(1)
{
if(i==l1)
{
printf("Yes\n");
break;
}
if(i<l1&&j==l2)
{
printf("No\n");
break;
}
if(st1[i]==st2[j])
{
i++;j++;
}
else
j++;
}
}
return 0;
}

POJ 1936 All in All(串)的更多相关文章

  1. OpenJudge/Poj 1936 All in All

    1.链接地址: http://poj.org/problem?id=1936 http://bailian.openjudge.cn/practice/1936 2.题目: All in All Ti ...

  2. POJ 1936 All in All(模拟)

    All in All 题目链接:http://poj.org/problem?id=1936 题目大意:判断从字符串s2中能否找到子串s1.字符串长度为10W. Sample Input sequen ...

  3. poj 1936 All in All(水题)

    题目链接:http://poj.org/problem?id=1936 思路分析:字符串子序列查找问题,设置两个指针,一个指向子序列,另一个指向待查找的序列,查找个字符串一次即可判断.算法时间复杂度O ...

  4. POJ 1936 All in All 匹配, 水题 难度:0

    题目 http://poj.org/problem?id=1936 题意 多组数据,每组数据有两个字符串A,B,求A是否是B的子串.(注意是子串,也就是不必在B中连续) 思路 设置计数器cnt为当前已 ...

  5. poj 1936 All in All

    All in All Time Limit: 1000 MS Memory Limit: 30000 KB 64-bit integer IO format: %I64d , %I64u   Java ...

  6. poj 1159 dp回文串

    题意:添加最少的字符使之成为回文串 #include<cstdio> #include<iostream> #include<algorithm> #include ...

  7. POJ 3461 Oulipo(模式串在主串中出现的次数)

    题目链接:http://poj.org/problem?id=3461 题意:给你两个字符串word和text,求出word在text中出现的次数 思路:kmp算法的简单应用,遍历一遍text字符串即 ...

  8. 简单的字符串比较题 POJ 1936

    Description You have devised a new encryption technique which encodes a message by inserting between ...

  9. POJ 3461 Oulipo(KMP,模式串在主串中出现次数 可重叠)

    题意:给你两个字符串p和s,求出p在s中出现的次数. 显然,我们要先把模式串放到前面,之后主串放后面,中间隔开,这样就可以根据前缀数组的性质来求了. 我先想直接把p接到s前面,之后求Next数组对st ...

随机推荐

  1. 【2018 CCPC网络赛】1004 - 费马大定理&数学

    题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6441 Knowledge Point: 1. 费马大定理:当整数n >2时,关于x, y, z的 ...

  2. 一套出完被喷爆的noip提高组+的题目

    这是一个悲伤的故事. 校内胡测嘛,这当然的重视啦,好好地出完题,看题面不是很难哦,那就用它吧. 结果今天老师考试就用上了(情况不妙) 果然考试过程中就有打喷嚏的冲动. 一道暴力,一道概率DP,一道主席 ...

  3. scanf_s获取参数,清空缓冲区,判断是否读取成功

    #include<stdio.h> int main() { ]; ) { printf("Please input:\n"); ); ) { printf(" ...

  4. 条款16:成对使用new和delete时要采取相同形式

    NOTE: 1.如果你在new表达式中使用[],必须在相应的delete表达式中也使用[].如果你在new表达式中不使用[],一定不要在相应的delete表达式中使用[].

  5. Java学习之File类理解

    File类是io包中唯一代表磁盘文件本身的对象.File类定义了一些与平台无关的方法来操作文件,可以通过调用File类中的方法,实现创建.删除.重命名文件等.File类的对象主要用来获取文件本身的一些 ...

  6. maven中的groupId和artifactId到底指的是什么?

    具体回答如下: groupid和artifactId被统称为“坐标”是为了保证项目唯一性而提出的,如果你要把你项目弄到maven本地仓库去,你想要找到你的项目就必须根据这两个id去查找. groupI ...

  7. java数据结构简单点

    java常用的数据结构一 集合框架主要就是Collection和Map: 1.Collection包含了List和Set两大分支. (1)List是一个有序的集合,每一个元素都有它的索引.第一个元素的 ...

  8. FZU-2147-2147 A-B Game,规律题。。

    Problem 2147 A-B Game Time Limit: 1000 mSec Memory Limit : 32768 KB  Problem Description Fat brother ...

  9. BZOJ4373 算术天才与等差数列 题解

    题目大意: 一个长度为n的序列,其中第i个数为a[i].修改一个点的值询问区间[l,r]内的数从小到大排序后能否形成公差为k的等差数列. 思路: 1.一段区间符合要求满足:(1)区间中的max-min ...

  10. unbuntu下安装多个JAVA JDK版本及如何切换

    当前环境已经安装过jdk1.6.0_45安装JDK 1.7.x时,若安装错误,可执行以下步骤:sudo add-apt-repository ppa:openjdk-r/ppa sudo apt-ge ...