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. Input is terminated by EOF.

Output

 For each test case output, if s is a subsequence of t.

Sample Input

sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter

Sample Output

Yes
No
Yes
No

HINT

   这个题用C++做的,一开始数组开小了,后来开太大了,果断选择string。代码简单,看就好不多解释。

Accepted

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std; int main() {
string s, t;
while (cin >> s >> t)
{
int j = 0;
for (int i = 0;i < t.length(); i++)
if (s[j] == t[i])j++;
cout << (j == s.length() ? "Yes" : "No" )<< endl;
}
return 0;
}

All in All UVA - 10340的更多相关文章

  1. 贪心水题。UVA 11636 Hello World,LA 3602 DNA Consensus String,UVA 10970 Big Chocolate,UVA 10340 All in All,UVA 11039 Building Designing

    UVA 11636 Hello World 二的幂答案就是二进制长度减1,不是二的幂答案就是是二进制长度. #include<cstdio> int main() { ; ){ ; ) r ...

  2. UVa 10340 - All in All 水题 难度: 0

    题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...

  3. uva 10340 All in All

    水题,从头到尾扫一遍就可以了,输入两个字符串s和t,判断是否可以从t中删除0个或多个字符(其他字符顺序不变),得到字符串s.例如,abcde可以得到bce,但无法得到dc. #include<a ...

  4. UVA 10340 (13.08.25)

    Problem E All in All Input: standard input Output: standard output Time Limit: 2 seconds Memory Limi ...

  5. UVa 10340 子序列

    https://vjudge.net/problem/UVA-10340 题意: 输入两个字符串s和t,判断是否可以从t中删除0个或多个字符得到字符串s. 思路: 很水的题... #include&l ...

  6. UVa 10340 All in All (水题,匹配)

    题意:给定两个字符串,问第一个串能不能从第二个串通过删除0个或多个字符得到. 析:那就一个字符一个字符的匹配,如果匹配上了就往后走,判断最后是不是等于长度即可. 代码如下: #include < ...

  7. UVA 10340 All in All(字符串,朴素匹配)

    #include <stdio.h> #include <algorithm> #include <cstring> using namespace std; ], ...

  8. 【习题 3-9 UVA - 10340】All in All

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 相当于让你判断s1是不是s2的子序列. for一遍就好 [代码] #include <bits/stdc++.h> us ...

  9. UVA 10340 - All in All 水~

    看题传送门 Problem E All in All Input: standard input Output: standard output Time Limit: 2 seconds Memor ...

随机推荐

  1. Docker中配置MySQL并实现远程访问

    Docker配置MySQL容器 拉取MySQL镜像 docker pull mysql:5.6 有可能会因为网络问题失败,重复尝试. 创建容器 docker run -d --name selfdef ...

  2. HTTP/1.1 有点慢,我想优化下!

    问你一句:「你知道 HTTP/1.1 该如何优化吗?」 我想你第一时间想到的是,使用 KeepAlive 将 HTTP/1.1 从短连接改成长链接. 这个确实是一个优化的手段,它是从底层的传输层这一方 ...

  3. LDAP + Samba 安装配置流程

    LDAP + Samba 安装配置 基础环境:Ubuntu18.04 安装samba root@cky:~# apt install samba smbldap-tools -y 查看版本 root@ ...

  4. 如何用css写一个带斜切角、有边框又有内外阴影的按钮呢?

    如果有一天,UI设计师丢过来一张UI稿,上面有这样一个带有斜切角.有边框还有内外阴影的按钮,你会怎么实现呢?第一反应切图?可是按钮内容.大小都是可变的,那得切多少图啊~Canvas?SVG?No,no ...

  5. 解决appium点击软键盘上的搜索按钮

    在执行appium自动化测试的时候,需要点击软件盘上的搜索按钮. 具体操作步骤如下: 前提:需要事先安装搜狗输入法 1.唤醒软件盘,可以封装到一个类里,用到的时候随时调用. import os#调起s ...

  6. Java多态练习题

    需求: 宠物饿了,需要铲屎官给宠物喂食. 不同宠物吃的东西不一样. 不同宠物恢复后体力值不一样. 铲屎官和狗狗玩接飞盘游戏,狗狗健康值减少10,与铲屎官亲密度增加5 铲屎官和 企鹅玩游泳游戏,企鹅健康 ...

  7. Java-for循环打印九九乘法表

    Java打印九九乘法表 public class forDemo04 { public static void main(String[] args) { //练习3:打印九九乘法表 /* 1*1=1 ...

  8. PicGo+Typora+Gitee设置图床

    PicGo图床 使用 Typora 编辑 MarkDown 非常方便,但是图片插入后只能保存在本地,十分讨厌 所以,可以使用图床技术,将图片先保存到网络端,再应用到 Typora 中 PicGo应用获 ...

  9. dom_bom学习

    1. bom是什么? browser object model(浏览器对象模型) 在浏览器中 window指的就是bom对象 //网页重定向 // window.location.href=" ...

  10. java将一个list转换成一个String,中间用分隔符隔开

    List sn=[123,1231,1231,231] sn.toString();//[123,1231,1231,231] sn.join(',').toString();//123,1231,1 ...