当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3302:Subsequence

题目描述

Given a string s of length n, a subsequence of it, is defined as another string s' = su1su2...sum where 1 ≤ u1 < u2 < ... < umn and si is the ith character of s. Your task is to write a program that, given two strings s1 and s2, checks whether either s2 or its reverse is a subsequence of s1 or not.

输入解释

The first line of input contains an integer T, which is the number of test cases. Each of the next T lines contains two non-empty strings s1 and s2 (with length at most 100) consisted of only alpha-numeric characters and separated from each other by a single space.

输出解释

For each test case, your program must output "YES", in a single line, if either s2 or its reverse is a subsequence of s1. Otherwise your program should write "NO".

输入样例
5
arash aah
arash hsr
kick kkc
A a
a12340b b31
输出样例
YES
YES
NO
NO
YES

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3302

最后修改于 2020-10-29T06:58:08+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536