A musical string is any string that can be played on a piano keyboard.
For those of us who weren't forced to learn the piano as kids, here is what the keyboard looks like.
So the string feed a dead cabbage
is a musical string because every single letter corresponds to one of these nots.
Your challenge is to write a program that takes a string as input from STDIN, and finds the longest musical substring. Then your program must print the substring, and it's length. Here are some sample inputs/outputs.
Input: "FEED ME! I'm hungry!"
Output: feed 4
Input: No no no, no musistrin!
Ouput: 0
Input:
"A **bad** !!!fAd82342"
Output: abadfad 7
Input: "Good golfing!"
Output: dg 2
Rules
Your output may be upper or lower-case, but there must be no punctuation or spaces.
There will capitalization and punctuation in the input string, but this doesn't affect whether or not a substring is considered "musical" or not.
There must be a space between the musical substring, and the number.