DUCKS - Here be ducks

no tags 

Ducky the Duck was walking by and he had a little idea, he wanted to see if making a line of dots with his pencil and throwing the letters of his name randomly at it he would be able to pick up the letters again and write his name perfectly, but some times when he throws them they fall out of the path. Ducky also throwed random characters to replace some of the dots, when he reaches a random character before he find his name he gets mad and scream NO DUCKY!, task is simple, just find Ducky´s name on the path he made.

Clarifications:

  1. Ducky starts looking for his name from the beginning of the string.
  2. Ducky want to find the letters of his name that means 'D' 'u' 'c' 'k' 'y' another letter even the letter 'd' is considered a random character.
  3. When he steps a dot he will keep searching for the name, if he steps a letter of his name and hasn´t found them all he will keep searching, when he finds a random character he will stop.

Input

T = Number of test cases, which are less than 20.

Then T lines will follow, each of them having a string representing the Ducky´s path.

Output

Output NO DUCKY! If you cannot find his name, otherwise print DUCKY IS HERE!

Example

Input:
5
Ducky...
.D...ucky
...Duck...
..D...uck!y
..u.c..ky.D

Output:
DUCKY IS HERE!
DUCKY IS HERE!
NO DUCKY!
NO DUCKY!
DUCKY IS HERE!

Extra: time limit reduced because there are fewer than 20 test cases and there is people getting 0.45 seconds on their answer, which for Ducky is unacceptable.


hide comments
Aradhya: 2012-04-12 00:58:59

ultimate question.!!!! AC :D

Nnavneetsinha: 2012-04-12 00:58:59

@Devil D and @nitish same problem of getting wa and i m also following the same logic.I don't know what is wrong with the problem.

Nitish Sharma: 2012-04-12 00:58:59

If the letters "Ducky" are encountered before any characters (other than '.') or end of line, in any order and any number of times, then the output should be DUCKY IS HERE!. Is it so???
I followed the same logic but getting wrong answer.

Edit: Your logic is correct, but you are not reading the problem CAREFULLY read it and you will see your mistake, you are really close to AC :D

Edit: pheww....finally AC :))

Last edit: 2012-04-08 22:38:48
Devil D: 2012-04-12 00:58:59

what is the length of te stream

Devil D: 2012-04-12 00:58:59

as i uderstand ... if all D u c k y appear before any special character r end of lne ... it means ducky found ...?
If yes then why am I getting wrong answer

Nnavneetsinha: 2012-04-12 00:58:59

anyone pls tell the output for
4
DDDDucky
yyyDuck
D..uuuucky
D.u.cc.kkkkkkkkk.yyyyy!

Edit: All of them are DUCKY IS HERE!

Last edit: 2012-04-09 03:18:08
Sourabh Singh: 2012-04-12 00:58:59

output for DDucky ??
NO DUCKY! ??

Edit: nop, it is DUCKY IS HERE!

Last edit: 2012-04-08 11:50:39
Faldi: 2012-04-12 00:58:59

Edit: AC:D

Last edit: 2012-04-08 10:00:57
Ikhaduri: 2012-04-12 00:58:59

Description isn't clear. What's output for yDcku ???

Edit: Read Question Carefully...
output for yDcku
DUCKY IS HERE!

Last edit: 2012-04-08 09:23:02
Nnavneetsinha: 2012-04-12 00:58:59

can you please check my solution .Id is 6087255.
Is my solution is still wrong in many test cases ??
give me one test caes where I am wrong.pls.


Added by:Rocker3011
Date:2012-04-07
Time limit:1s
Source limit:5000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own problem