Neosify - Buy, Stake & Earn Crypto
Neosify - Buy, Stake & Earn Crypto
Neosify - Buy, Stake & Earn Crypto
Dcoder logo

String Matching @ Dcoder

By Lochard | As a newbie programmer | 10 Mar 2023

Problem: Cody has a sequence of characters N. He likes a sequence if it contains his favourite sequence as a substring.

Given the sequence and his favourite sequence F, check whether the favourite sequence is present in the sequence.

Input: The first line of input contains a single line T, which represents the number of test cases. 

Each test case consists of 2 strings separated by space N and F respectively.

Output: Print "Yes" if the sequence contains the favorite sequence in it, otherwise print "No".

Constraints: 1<=T<=10.


All the characters are lowercase alphabets.

Sample Input: 2

abcde abc

pqrst pr

Sample Output: 



for i in range(int(input())):
  n, f = input().split()
  print('Yes' if f in n else 'No')

How do you rate this article?



Asylum seeker in Lithuania. My short-lifed daily on GitHub

As a newbie programmer
As a newbie programmer

Sharing entry level codes. My snippets on GitHub

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.