Poetry is a form of literature that uses aesthetic and rhythmic qualities of language. There are many famous poets in the contemporary era. It is said that a few ACM-ICPC contestants can even write poetic code. Some poems has a strict rhyme scheme like "ABABA" or "ABABCAB". For example, "niconiconi" is composed of a rhyme scheme "ABABA" with A = "ni" and B = "co".
More technically, we call a poem pretty if it can be decomposed into one of the following rhyme scheme: "ABABA" or "ABABCAB". The symbol A, B and C are different continuous non-empty substrings of the poem. By the way, punctuation characters should be ignored when considering the rhyme scheme.
You are given a line of poem, please determine whether it is pretty or not.
Input
There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:
There is a line of poem S (1 <= length(S) <= 50). S will only contains alphabet characters or punctuation characters.
Output
For each test case, output "Yes" if the poem is pretty, or "No" if not.
Sample Input
3 niconiconi~ pettan,pettan,tsurupettan wafuwafu
Sample Output
Yes Yes No
1 /* 2 许杰浩的题解: 3 AC代码: 4 */ 5 #include <iostream> 6 #include <cstdio> 7 #include <string.h> 8 #include <cstring> 9 using namespace std; 10 char str[55],s1[55]; 11 char s2[55],s3[55],s4[55]; 12 int cnt; 13 void getap(){ 14 cnt=1; 15 int l=strlen(str); 16 for(int i=0;i<l;i++){ 17 if(str[i]<='z'&&str[i]>='a'){ 18 s1[cnt++]=str[i]; 19 } 20 else if(str[i]<='Z'&&str[i]>='A'){ 21 s1[cnt++]=str[i]; 22 } 23 } 24 } 25 void getstr(int i,int j,char *s){ 26 int p=0; 27 for(int k=0;k<55;k++)s[k]='