Social Media Marketing Optimization
In the world of digital marketing, businesses are always competing for the audience's attention. The competition is even fiercer in the world of social media marketing, where shorter, punchy sentences often win the day. A rookie social media marketer has made a blunder and crafted some posts with sentences far too long for the audience's rapidly shrinking attention span.
Your task is to create a program using regular expressions to help identify and print out all sentences in the post that are longer than a specified length so they can be reviewed and revised.
The first line of the input contains the text comprising several sentences. The second line contains a single integer
n
that signifies the maximum sentence length deemed suitable.A sentence is defined as a group of words followed by a full stop (
.
), question mark (?
), or exclamation mark (!
). Your program should print all sentences whose length (including punctuation and spaces) exceeds n
, each sentence printed on a new line.Input | Output |
Welcome to the big city! The lights are bright. Have you seen the park? The park is massive, with a beautiful pond, a variety of trees, and plenty of benches to sit and enjoy the surroundings. It's the perfect place to take a break from the hustle and bustle of city life. Visit us soon!
75 | The park is massive, with a beautiful pond, a variety of trees, and plenty of benches to sit and enjoy the surroundings.
It's the perfect place to take a break from the hustle and bustle of city life. |
Note: Sentences should be printed in the order they appear in the input text.
Constraints
Time limit: 0.2 seconds
Memory limit: 512 MB
Output limit: 1 MB