Build the String
Time limit1sMemory limit1024 MB
Given a string of length N up to 10, the task is to check whether the substring gori appears in it and print YES or NO.
- Level
Easy1 of 10
- Topics
- String, String matching
- Solved
- No attempts yet
Problem
Hoban-woo considers that gori is derived from a string when gori appears in it as a contiguous substring. Given one string of length , determine whether gori is derived from that string by Hoban-woo's rule.
Input
The first line contains the length of the string.
The second line contains the string of length . The string consists only of lowercase English letters.
Output
If gori is derived from the given string, print YES. Otherwise, print NO.
Hint
A contiguous substring is a string left after removing any number of characters from the start and the end of the original string. Removing no characters from either end is also allowed.