using System;
using System.Text;
public static class ClipboardFusionHelper
{
        public static string ProcessText(string text)
        {
            string output = "> ";
            int charCount = 0;
            foreach (string word in text.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries))
            {
                if ((word.Contains("\n")) || (word.Contains("\r")) || (word.Contains("\0")))
                {
                    string newWord = word.Replace(Environment.NewLine, "\n");
                    newWord = newWord.Replace("\r", "\n");
                    newWord = newWord.Replace("\0", "\n");
                    output += newWord.Replace("\n", Environment.NewLine + "> ") + " ";
                    charCount = newWord.Length + 1;
                }
                else if (charCount > 72 - word.Length)
                {
                    output = output.TrimEnd() + Environment.NewLine + "> " + word + " ";
                    charCount = word.Length + 1;
                }
                else
                {
                    output += word + " ";
                    charCount += word.Length + 1;
                }
            }
            return output;
        }
}