Fancy Quotes--getting correct for mentioned test cases in editorials in code blocks but code isn't getting accepted. Plz tell what is wrong in my code

link text

Your code seems to have a few bugs. I can see that it is gonna give a WA for quite a few cases. Try to find the bugs in your code and then according make some changes. Try some corner cases.
For example:
When the input is :
i am not
i an nothing
Your code gives the output as:
regularly fancy
Real fancy
regularly fancy

whereas the answer should be:
Real Fancy
regularly fancy
regularly fancy

Check your code on more test cases and then resubmit your code.
You can refer to my code too to understand it more clearly: