¡We're going to give exclamation and question marks inverted buddies!
Given a body of text containing sentences ending in
!, prepend inverted question marks,
¿, to interrogative sentences (sentences ending in
?) and inverted exclamation marks,
¡, to exclamatory (sentences ending in
!). Sentences ending in
. are to be ignored.
Sentences will be separated by whitespace (spaces, tabs, and/or newlines) and will only contain alphanumerics, commas, apostrophes, and spaces. Every sentence will have at least one word. The first word of every sentence is guaranteed to be capitalized. Input can start and end with any whitespace.
Hello there! What is your name? My name is Ron. What's your name? My name is Alex. Nice to meet you! Nice to meet you to! How was your break? It was great, I spent all my time code golfing! What's that? Wow, you're such a n00b! Here, let me show you.
¡Hello there! ¿What is your name? My name is Ron. ¿What's your name? My name is Alex. ¡Nice to meet you! ¡Nice to meet you to! ¿How was your break? ¡It was great, I spent all my time code golfing! ¿What's that? ¡Wow, you're such a n00b! Here, let me show you.
- All default Code Golf rules apply.
- The program with the shortest amount of bytes wins.
Bonus (17% off) - Parse multiple marks
A sentence can also end in multiple exclamation/question marks. Give each of these marks a paired inverse exclamation/question mark for an extra 17% off your byte count.
I am a man in a can doing a dance?? Maybe... Doing it for the views??!???!
¿¿I am a man in a can doing a dance?? Maybe... ¡¿¿¿¡¿¿Doing it for the views??!???!
¿¿I am a man in a can doing a dance?? Maybe... ¿¿¡¿¿¿¡Doing it for the views??!???!