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
(^_^): 2012-04-12 00:58:59

Is there any problem with the test data my solution seems correct can you please check the code id
6807245

Edit: you are falling on some cases, and nothing is wrong with the test cases, there was a problem with a freopen space, but fixed before more than 15 submits

Last edit: 2012-04-08 11:45:08
Ngiong: 2012-04-12 00:58:59

finally got AC... thank you...

Last edit: 2012-04-08 10:26:08
avinash: 2012-04-12 00:58:59

Edit: keep trying you are failing on only one special test case

Last edit: 2012-04-08 07:13:19
Nnavneetsinha: 2012-04-12 00:58:59

1
!...Ducky
wha is the output?

edit: NO DUCKY!

Last edit: 2012-04-08 06:37:53
Nnavneetsinha: 2012-04-12 00:58:59

3
d..ucK..Y [INVALID]
DUCKY [INVALID]
Duck....y [VALID]
what should be the output?

Edit: your output is correct

Last edit: 2012-04-08 05:54:49
david_8k: 2012-04-12 00:58:59

Ok, new question, so we don't have to care about the uppercase 'D'

edit: kind of, Ducky´s name is with an uppercase D so 'd' is not considered part of his name

David says: Then the string "ydcku" should output "NO DUCKY!"

edit: True T_T my bad hehehe d:

Last edit: 2012-04-07 22:43:37
david_8k: 2012-04-12 00:58:59

Problem statement is unclear about what we have to do...
2
ydcku
Ducky!duck

what is the correct output for those test cases?

edit: ok i said randomly so, but if you feel it isn´t enough clear
1-NO DUCKY! my bad T_T
2-DUCKY IS HERE! cause he reaches all the name before the random character

Last edit: 2012-04-07 22:43:09
Luis Arguello: 2012-04-12 00:58:59

Tutorial ;)

Rodolfo says: maybe xD

Last edit: 2012-04-07 18:29:48
david_8k: 2012-04-12 00:58:59

1
yDcku
What should be the output?

edit: Read the problem, Ducky tells you to read carefully :D

Last edit: 2012-04-07 18:14:16

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