Question
Coding problems. In any programming languages.. Pleae need help You are given some text containing characters which could be English letters, spaces, commas (,), full
You are given some text containing characters which could be English letters, spaces, commas (,), full stops (.), and question marks (?), that a user would like to send as an SMS, and a limit specifying the maximum number of characters a single message can contain. Your task is to split the text into the lowest number of SMS message required to fit all characters in text. Each message should contain some part of the text, followed by the suffix , where y is the total number of messages, and x is the number for the current message (starting from 1). The suffix is considered a part of the message. So, the total length of each message includes the length of the suffix.
Text can only be split into different SMS messages no spaces, and spaces used for splitting should not include be in either part of the split. For example, hello, world can only be split into hello, and world.
Return an array containing all SMS messages. If its impossible to split the text into different messages based on the limit for each message, return an empty array. If multiple solutions with the same number of messages are possible, earlier message should be as long as possible and latter messages should be decreasing in length.
For example,
For text = a b c and limit = 6, the output should be
smsSplitter(text,limit) = [a, b, c ]2,3>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started