2002 LSU Computer Science High School Programming Contest

Sponsored by Microsoft

Novice - Problem 7

Accounting Blues

Sam Slacker has decided to take a small bit of revenge on his last employers. He served a small stint as a sysadmin at a local dSP, and they forgot to remove his access upon firing him for, well, slacking off.

He's decided to subtly alter their account deletion mechanism. If it comes across any name with 'SAMMY' in it, his altered version will not allow the account to be deleted. This will undoubtedly cause no small degree of consternation at the dSP, which is just what Sam wants. After all, he only played games on the clock some of the time, so he feels that he deserves to keep his accounts . . .

Description:

You are to check a name to see if it contains the string SAMMY inside of it. The check should be case-insensitive; Sammy, SAMMY, and sAmMy are all equivalent, and will not be deleted. As well, any character which is not a number or a letter should be ignored. This means that the deletion program will delete Sa33mmy00, but it will not delete ABC#$S_a)()(MM**Y1.

Input:

The first piece of data in the file is the number of names to read in and try to delete, c, represented by a non-negative integer. The next c lines are the names to try to delete. Names are all of the characters on the line until the end of the line. There will be no spaces, tabs, or control characters--there will be no whitespace in a name.

Output:

For each name, print

	Name x: Deleted: s 
if the name is successfully deleted by the altered program, or
	Name x: Not Deleted: s
if the name is not deleted. x is the name number, starting from 1, and s is the actual line of text that is checked.

Sample Input:

5					Number of names to read
Sammy_rules				First name
Samm3_rules				Second name
Sa_MMy					Third name
S_A_*M*()()(M$^%$^%y			Fourth name
123sAM2My321				Fifth name

Sample Output:

Name 1: Not Deleted: Sammy_rules
Name 2: Deleted: Samm3_rules
Name 3: Not Deleted: Sa_MMy
Name 4: Not Deleted: S_A_*M*()()(M$^%$^%y
Name 5: Deleted: 123sAM2My321