Knowing that he needs to make up for his lack of programming experience, Ace has set out to write perfect essays for the AIF. He wants to show his excitement for Waterloo and thus has requested that you make a program for him that adds !!!EXCITEMENT!!! to his essay. What better way to show excitement than exclamation marks! Ace has written an essay of lines. Replace every period, .
, with three exclamation marks, !!!
. Additionally, any word in all uppercase should be surrounded by three exclamation marks on each side. For example, the word COMPUTER
should become !!!COMPUTER!!!
.
Note: punctuation other than periods should be treated as part of the original word, e.g. 1^ST
becomes !!!1^ST!!!
.
Input Specification
First line: , the number of lines to follow.
Every even line: an integer , the number of space-separated strings in the following line of text.
Every odd line: a line of his essay, no longer than characters.
Output Specification
The essay with !!!excitement!!!.
Sample Input 1
2
8
My name is Ace Zhan. I love programming
9
and I want to be the BEST programmer alive.
Sample Output 1
My name is Ace Zhan!!! !!!I!!! love programming
and !!!I!!! want to be the !!!BEST!!! programmer alive!!!
Sample Input 2
2
9
Ever since Mr. Kong introduced me to computer science,
7
I have been hooked. <3 the man
Sample Output 2
Ever since Mr!!! Kong introduced me to computer science,
!!!I!!! have been hooked!!! <3 the man
Comments
Can a string be uppercase and then have a period at the end? I'm basically asking if there is a possibility to type 6 !s other than if there are two periods.
The input data for this problem contained Unicode characters and have since been fixed to only contain ASCII characters. All out-of-contest submissions have been rejudged.
Can i get some feedback?
This may be a long shot, but the test case
a A
, with two whitespaces, fails.Also, you use twice the amount of memory than the limit. You may want to work on that first.
What am I getting wrong?
Try to apply .upper to an int in your shell. You'll know what's wrong afterwards
"123".upper() outputs 123? Is a word composed of only integers considered capitalized
No, I think the point was to recognize the opposite. Don't take integral values as capital letter words.
wait so I'm not suppose to count it as a capital right
according to python yes
It could've been a lot easier for you and me to restate the problem in a way that any decent human being can understand. Thanks <3
Any specific points of clarification that you need?
hI my NaMe is ACE Zhan. => hI my NaMe is !!!ACE!!! Zhan!!!
nice to met you Sir => nice to meet you Sir
Williams the 4.th o => Williams the 4!!!th o
Any insight why is thing wrong ? Sorry again :sad:
Your mistake occurs after that section. I don't wish to give too much away but look at the sample inputs and outputs carefully. Also consider what happens when you need to add more than one set of !!!