using System.Collections.Generic;
using System.Text.RegularExpressions;
public static void Main()
var script = @" We're glad you called. Its customers like you... Welcome to Sapiens Technologies, your trusted partner in business automation solutions.
Our commitment is to provide you with the best experience and assistance at all times. To ensure efficient service, please listen carefully to the following options.
If you know the extension of the person you wish to speak with, you may dial it at any time. Otherwise, please select one of the following options: For Sales, press 1.
If you are interested in our products or services and would like to speak with a sales representative, press 1, and we will be happy to assist you.
You can also email us at sales@sapientech.com, and we will respond promptly.For Customer Support, press 2. If you need help with an order, have a question about our products, or want to track your request, press 2,
and one of our advisors will assist you as soon as possible. You can also visit our website at www.sapientech.com/support to access our FAQ section and online support.
For Billing and Payments, press 3. If you need information about your invoice, payment methods, or have questions about a charge, press 3. You can also email us at billing@sapientech.com for additional assistance.
For Technical Support, press 4. If you are experiencing difficulties with any of our products or services, press 4 to be transferred to our support team.
You can visit our help section at www.sapientech.com/help to find guides and quick solutions.For Employee Directory, press 5. If you wish to contact a specific person within our company, enter their name using your phone keypad.
To speak with an operator, press 0 or stay on the line.If you are calling outside our business hours, please note that we are available Monday to Friday from 8:00 AM to 6:00 PM.
You may leave a message with your name, phone number, and reason for your call, and we will get back to you as soon as possible. For more information, please visit our website at www.sapientech.com.
if all our agents are currently busy, your call will be attended to as soon as possible. While you wait, we invite you to visit our website,
where you will find answers to frequently asked questions and self-service options that may resolve your inquiry without having to wait on the line.Thank you for calling Sapiens Technologies.
Your call is very important to us. Welcome to Sapiens Technologies, your trusted partner in business automation solutions. Our commitment is to provide you with the best experience and assistance at all times.
Welcome to Sapiens Technologies, your trusted partner in business automation solutions. Our commitment is to provide you with the best experience and assistance at all times.
If you need to update your account details or reset your password, please visit our account management portal at www.sapientech.com/account. For information about our latest features and updates,
press 6 to hear more about what’s new at Sapiens Technologies. To speak with our HR department regarding job opportunities or company policies, press 7. If you require immediate assistance, please stay on the line,
and one of our representatives will be with you shortly. We appreciate your patience and look forward to assisting you.";
var result = SplitTextIntoChunks(script, 2300);
for (int i = 0; i < result.Count; i++)
Console.WriteLine($"- Chunk {i}:");
Console.WriteLine($"{result[i]}");
private static List<string> SplitTextIntoChunks(string text, int maxCharacters)
List<string> chunks = new List<string>();
var sentences = Regex.Split(text, @"(?<=[.!?])\s+");
StringBuilder currentChunk = new StringBuilder();
foreach (var sentence in sentences)
if (currentChunk.Length + sentence.Length > maxCharacters)
chunks.Add(currentChunk.ToString().Trim());
currentChunk.Append(sentence + " ");
if (currentChunk.Length > 0)
chunks.Add(currentChunk.ToString().Trim());