Programming contests

ACM ICPC programozó csapatverseny, házi forduló, 2014. október 22.

October 22, 2014 10:05 AM – October 22, 2014 3:05 PM

I Love Strings!!!

Hmmmmmm… strings again. :) Then it must be an easy task for you. Well… You are given a string S of length not more than 100,000 characters (only “a” – “z” and “A” – “Z”). Then follows q (q < 1000) queries, each containing a string T of maximum length 1,000 (also contains only “a” – “z” and “A” – “Z”). You should determine whether or not T is a substring of S.

Input Specification

The first line contains an integer k (k < 10), telling the number of test cases to follow. Each test case begins with S. It is followed by q. After this line, there are q lines, each of which having a string T as defined above.

Output Specification

For each query, print “y” if it is a substring of S, or “n” otherwise, followed by a new line. See the sample output below.

Sample Input

  1. 2
  2. abcdefghABCDEFGH
  3. 2
  4. abc
  5. abAB
  6. xyz
  7. 1
  8. xyz
download as text file

Output for Sample Input

  1. y
  2. n
  3. y
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019