Under construction

Still being built. Things may change

Irregular Expressions (Large)

Time limit5sMemory limit512 MB

Summary
Decide if any substring of each string splits into equal start and end words of two or more syllables around a middle word.
Level

Medium5 of 10

Topics
Brute force, String, String matching
Solved
No attempts yet

Problem

You are competing at the 2011 World Witch and Warlock Tournament. In this round the Head Witch tests how well the contestants deflect spells. The contestants stand in a circle, the Head Witch stands in the center and starts casting spells, and every contestant has to answer with a counter-spell as fast as possible. A contestant who is too slow risks being turned into a toad or petrified.

Each spell the Head Witch casts consists of three words: the start word, the middle word and the end word. A word consists of one or more syllables. A syllable is a nonempty string of letters that contains exactly one vowel. The five vowels are "a", "e", "i", "o" and "u", and every other letter is a consonant, including "y". The start word is always equal to the end word and has at least two syllables.

"ab", "ra", "cad", "o" and "shabbr" are valid syllables. "ero" and "grrgh" are not.

The Head Witch speaks very fast, so you cannot tell where one word ends and the next one begins. She also says useless gibberish before and after a spell to confuse the contestants, and sometimes she casts no spell at all and says something unrelated instead.

For example, she may say "abracadabra", which contains the spell made of the words "abra", "cad" and "abra". The start word and the end word are the same, and "abra" splits into the two syllables "ab" and "ra". The splits "a-bra" and "abr-a" work as well. The word "cad" is a single syllable. She may also say "kajabbamajabbajab", which contains the spell "jabba ma jabba". "frufrumfuffle" is gibberish and contains no spell.

An expression contains a spell when at least one of its contiguous substrings is a spell. For each expression the Head Witch says, decide whether it contains a spell.

Input

The first line contains the number of test cases TT. Each of the next TT lines contains one expression, made of lower case English letters with no spaces.

Limits

  • 1≤T≤1001 \le T \le 100
  • Each expression has between 11 and 100100 characters.

Output

For each test case, print one line of the form "Case #x: y", where xx is the test case number starting from 11 and yy is "Spell!" if the expression contains a spell and "Nothing." otherwise. Match the spelling and the punctuation exactly.

Examples2

  1. Example 1

    Input
    4
    abracadabra
    kajabbamajabbajab
    frufrumfuffle
    schprexityschprex
    
    Expected output
    Case #1: Spell!
    Case #2: Spell!
    Case #3: Nothing.
    Case #4: Nothing.
    
  2. Example 2

    Input
    4
    aaaaa
    aaaa
    a
    z
    
    Expected output
    Case #1: Spell!
    Case #2: Nothing.
    Case #3: Nothing.
    Case #4: Nothing.