Pawri Meme - i

0

0 votes
Problem

Alice has recently seen the pawri meme "Yeh Humari Car Hai... Aur Yeh Hum Hai... Aur Yeh Humari Pawri Ho Rahi Hai..." and she liked it.

Now she wants to make the same video with her friends but her phone is locked because of many false attempts. Now there is only one way to unlock the phone, phone display shows one string S with N letters in it and two buttons below it.

Alice has to check whether it is possible to select subarray (contiguous), such that by rearranging it, the word "pawri"(without quotes) can be formed. And has to select "YES" or "NO"

As this is Alice's last chance to unlock the phone without losing data, she must choose the correct answer else she will lose access to all her data and won't be able to post her "pawri video". Can You help her to get the correct answer?

 

CONSTRAINTS:

1 <= T <= 100

1 <= |S| <= 105

S contains only lower case alphabets

INPUT FORMAT :

First-line contains a single integer T, denoting test cases.

Each Testcase contains single line containbing string S

 

OUTPUT FORMAT:

Check if it is possible to select a subarray of string S, such that by rearranging it we can form "pawri" word (without quotes).

If it is possible print Yes else print No (case sensitive)

 

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?