#C2888. Taco Substring Detection
Taco Substring Detection
Taco Substring Detection
Given a pattern string and a text string, determine whether the pattern is a substring of the text.
If the pattern is found in the text, output YES
; otherwise, output NO
.
Note: The pattern is considered a substring if it appears consecutively at any position within the text.
Examples:
- Pattern: "abc", Text: "abcdefg" → Output: YES
- Pattern: "hello", Text: "worldhello" → Output: YES
- Pattern: "abc", Text: "defghijk" → Output: NO
inputFormat
The input consists of two lines read from standard input:
- The first line contains the pattern string.
- The second line contains the text string.
Both strings consist of printable characters.
outputFormat
Output a single line to standard output. Print YES
if the pattern is found in the text, otherwise print NO
.
abc
abcdefg
YES