UVa 10340 All in All
来源:互联网 发布:mac jenkins 安装 编辑:程序博客网 时间:2024/06/18 03:47
10340 All in All
You have devised anew encryption technique which encodes a message by inserting between itscharacters randomly generated strings in a clever way. Because of pendingpatent issues we will not discuss in detail how the strings are generated andinserted into the original message. To validate your method, however, it isnecessary to write a program that checks if the message is really encoded inthe final string.
Given two strings s and t, you have to decide whether s is asubsequence of t, i.e. if you can remove characters from t such that the concatenation of the remaining characters is s.
Input
The inputcontains several testcases. Each is specified by two strings s,tof alphanumeric ASCII charactersseparated by whitespace. Input is terminated by EOF.
Output
For each testcase output, if s is a subsequence of t.
Sample Input
sequencesubsequence person compression
VERDIvivaVittorioEmanueleReDiItalia caseDoesMatter CaseDoesMatter
Sample Output
Yes
No
Yes
No
#include<stdio.h>#include<string.h>char s[100010],t[1000010];int main(){int i,j,log,lens,lent;while(scanf("%s %s",s,t)!=EOF){lens=strlen(s);lent=strlen(t);//printf("%s lens=%d\n%s lent=%d\n",s,lens,t,lent);log=0;for(i=0;i<lent;i++) if(log<lens) {if(t[i]==s[log]) log++;} else break; if(log==lens) printf("Yes\n"); else printf("No\n");}return 0;}
- UVa 10340 - All in All
- UVa 10340 - All in All
- uva 10340 - All in All
- uva 10340 - All in All
- UVa 10340 - All in All
- UVA 10340 All in All
- UVa 10340 - All in All
- uva 10340 all in all
- UVa 10340 - All in All
- Uva 10340 ALL IN ALL
- uva 10340 All in All
- UVA 10340 - All in All
- uva 10340 All in All
- uva 10340 All in All
- uva 10340 All in All
- uva 10340 - All in All
- UVA-10340-All in All
- UVa 10340 - All in All
- 敏捷开发Scrum
- 机试算法讲解: 第37题 Dijkstra
- ubuntu 如何创建新用户
- iOS alloc和new的区别与联系
- windows下如何将本地项目push到github仓库
- UVa 10340 All in All
- zedboard 8路拨码开关
- HDU 2128Tempter of the Bone II(bfs + 保存每一步的图)
- 【练习笔记】剑指offer-面试题6 :重建二义树
- 正则表达式
- hdu 1384 Intervals 差分约束系统
- Linux下Socket编程
- 本地连接显示正在识别
- 机试算法讲解: 第38题 求Dijkstra最短路径及花费