All in All POJ1936
来源:互联网 发布:77pepecom现在域名 编辑:程序博客网 时间:2024/05/16 07:54
All in All
Time Limit: 1000MS Memory Limit: 30000KB 64bit IO Format: %lld & %llu
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.
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 subsequenceperson compressionVERDI vivaVittorioEmanueleReDiItaliacaseDoesMatter CaseDoesMatter
Sample Output
YesNoYesNo
数电实验做砸了。写道水题冷静冷静,好好的为什么要学数电呢?哎。。。。
代码如下,不多说
#include<iostream>#include<cstring>#include<string>#include<algorithm>using namespace std;int main(){string str1,str2;while(cin>>str1>>str2){ int len=str1.length();int len2=str2.length();bool flag=false;for(int i=0,j=0;i<len2;i++){ if(str1[j]==str2[i])j++; if(j>=len){flag=true;break;} } if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;}return 0;}
0 0
- poj1936 All in All
- POJ1936--All in All
- POJ1936:All in All
- POJ1936《All in All》
- poj1936 All in All
- poj1936 All in All
- poj1936--All in All
- poj1936 All in All
- poj1936 All in All
- POJ1936-All in All
- poj1936 All in All
- All in All POJ1936
- POJ1936——All in All
- POJ1936-All in All(java版)
- POJ1936 All in All 字符串水题
- POJ1936-All-in-All(子序列)
- POJ1936——All in All
- UVA10340 POJ1936 ZOJ1970 All in All
- 视频前背景分离论文之(2) GOSUS: Grassmannian Online Subspace Updates with Structured-sparsity
- 结构体的初始化
- MLlib-Kmeans遇到的异常
- 11301
- 154. Find Minimum in Rotated Sorted Array II[hard]
- All in All POJ1936
- 11302
- Java的移位操作
- 学习别人的博客
- php高级特性-反射
- java入门3-运算符
- 文章标题
- JAXB入门教程
- 线性表的基础知识