Add Drama to String
Transform a string by adding one exclamation mark to every group of consecutive exclamation marks and converting all periods to exclamation marks.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late January, 2026
Problem: Add Drama You are asked to add some drama to a string. Given your string, you must: Add one exclamation mark to every group of consecutive exclamation marks (a single exclamation mark is also considered a group). Then, change all the periods (.) to exclamation marks (!). Example: Input: Roses are red. Oranges are orange! Output: Roses are red! Oranges are orange!! Implementation Details: Function: Implement the method addDrama. Parameters: * text (String): An ASCII string, defining the text to be dramatized. Return Value: * dramatizedText (String): The dramatized string.
Hello Interview Premium
Your account is free and you can post anonymously if you choose.