F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Hidden String

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 2328    Accepted Submission(s): 916


Problem Description
Today is the 1st anniversary of BestCoder. Soda, the contest manager, gets a string $s$ of length $n$. He wants to find three nonoverlapping substrings $s[l_1..r_1]$, $s[l_2..r_2]$, $s[l_3..r_3]$ that:

1. $1 \le l_1 \le r_1 < l_2 \le r_2 < l_3 \le r_3 \le n$

2. The concatenation of $s[l_1..r_1]$, $s[l_2..r_2]$, $s[l_3..r_3]$ is "anniversary".
 

Input
There are multiple test cases. The first line of input contains an integer $T$ $(1 \le T \le 100)$, indicating the number of test cases. For each test case:

There's a line containing a string $s$ $(1 \le |s| \le 100)$ consisting of lowercase English letters.
 

Output
For each test case, output "YES" (without the quotes) if Soda can find such thress substrings, otherwise output "NO" (without the quotes).
 

Sample Input
2 annivddfdersewwefary nniversarya
 

Sample Output
YES NO
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-27 11:33:59, Gzip enabled