You are not logged in. Please login at www.codechef.com to post your questions!

×

Genes and Chromosomes

There are a number of genes in a chromosome and your bioinformatic friend wants to check if a particular chromosome has a series of genes or not. The sequence in which genes occur is important. You want to help your friend in this matter. He gives you n chromosomes and a series of genes he wants to check. Help him identify whether these genes are present in the chromosome in the given order.

Because you are not a biology student, he’s made things easier for you. He represents genes by a letter, number or special character present in ASCII. Spaces do NOT represent a gene.

Example

If the chromosome is abdfgc, and the genes he’s querying for is abc, these are present (in the correct order) in the chromosome (marked in bold). abdfgc. However if the query is bca, this is not present in the correct order in the chromosome.

Input

The first line of input consists of an integer n which is the number of test cases.

Each test case consists of two lines of input:

The first line contains the chromosome The second line contains the gene you are querying for Output

The output for that chromosome-gene pair should be “YES” if the genes, taken in order, are contained in the chromosome and “NO” otherwise. The output should have n lines containing YES/NO.

Constraints

1 <= n <= 10000

1 <= |chromosome| <100

1 <= |gene| < |chromosome|

Sample Input

4
12sd78f
sf
12345efd
1e3d
ijkfgds
jkf
1111456
116
Sample Output

YES
NO
YES
YES

asked 05 Oct '18, 00:48

anuragm339's gravatar image

0★anuragm339
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,664
×1,409
×1,313
×181
×19
×12

question asked: 05 Oct '18, 00:48

question was seen: 318 times

last updated: 05 Oct '18, 00:48