GFSSOC '17 J3 - AIF Essay

View as PDF

Submit solution

Points: 7
Time limit: 1.0s
Memory limit: 31M

Authors:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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 N (1 \le N \le 100) 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, i.e. 1^ST becomes !!!1^ST!!!)

Input Specification

First line: N, the number of lines to follow.

Every even line: an integer k (1 \le k \le 200), the number of space-separated strings in the following line of text.

Every odd line: a line of his essay, no longer than 200 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


  • 0
    Epicnerdking  commented on Dec. 27, 2017, 7:38 p.m.

    I'm getting AC for cases 1 and 3, but UnicodeDecodeError for the rest on Python3. Which encoding should I use to avoid this? Thanks! :)


    • 0
      Wandex  commented on March 14, 2018, 8:57 p.m.

      I'm also getting UnicodeDecodeError but I'm using the builtin isupper() function, what is wrong with my code?


    • 1
      max  commented on Dec. 27, 2017, 8:18 p.m. edit 2

      The error is within your function "allcaps". Actually, there is an inbuilt string function called isupper() which will help you nail the question.


  • -1
    deleted  commented on Jan. 20, 2017, 6:10 p.m.

    What am I getting wrong?


    • 0
      P234rex  commented on Jan. 20, 2017, 6:24 p.m.

      Try to apply .upper to an int in your shell. You'll know what's wrong afterwards


      • 0
        deleted  commented on Jan. 20, 2017, 6:55 p.m.

        "123".upper() outputs 123? Is a word composed of only integers considered capitalized


        • 0
          tig567899  commented on Jan. 20, 2017, 7:02 p.m.

          No, I think the point was to recognize the opposite. Don't take integral values as capital letter words.


          • 0
            deleted  commented on Jan. 20, 2017, 7:42 p.m.

            wait so I'm not suppose to count it as a capital right


        • 0
          P234rex  commented on Jan. 20, 2017, 7:02 p.m.

          according to python yes


  • -1
    MajedAbdennadher  commented on Jan. 20, 2017, 3:19 p.m.

    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


    • 0
      P234rex  commented on Jan. 20, 2017, 3:58 p.m.

      Any specific points of clarification that you need?


      • 0
        MajedAbdennadher  commented on Jan. 20, 2017, 4:06 p.m.

        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:


        • 0
          P234rex  commented on Jan. 20, 2017, 4:15 p.m. edited

          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 !!!


  • 0
    P234rex  commented on Jan. 2, 2017, 11:42 p.m. edited

    Read the problem statement carefully