using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
public class Test
{
public static void Main()
{
List<string> ok = new List<string>();
List<string> err = new List<string>();
var lista = new[] { "ERIK ADESIR COMPANY LA ISLA DE LA PALMA" };
foreach (string dir in lista)
{
var match = Regex.Match(dir, @"^(.{1,32})([ ]+.{1,30})?([ ]+.{1,30})?$");
if (match.Success)
{
var cap = match.Groups;
ok.Add($"{dir};{cap[1].Value};{(cap[2].Success ? cap[2].Value.Trim() : "")};{(cap[3].Success ? cap[3].Value : "")}");
}
else
{
err.Add(dir);
}
}
Console.WriteLine(string.Join("\n", ok));
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLklPOwp1c2luZyBTeXN0ZW0uTGlucTsKdXNpbmcgU3lzdGVtLlRleHQuUmVndWxhckV4cHJlc3Npb25zOwoKcHVibGljIGNsYXNzIFRlc3QKewoJcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQoJewoJCUxpc3Q8c3RyaW5nPiBvayA9IG5ldyBMaXN0PHN0cmluZz4oKTsKCSAgICBMaXN0PHN0cmluZz4gZXJyID0gbmV3IExpc3Q8c3RyaW5nPigpOwoKICAgIAl2YXIgbGlzdGEgPSBuZXdbXSB7ICJFUklLIEFERVNJUiBDT01QQU5ZIExBIElTTEEgREUgTEEgUEFMTUEiIH07CiAgICAJZm9yZWFjaCAoc3RyaW5nIGRpciBpbiBsaXN0YSkKICAgIAl7CgkgICAgICAgIHZhciBtYXRjaCA9IFJlZ2V4Lk1hdGNoKGRpciwgQCJeKC57MSwzMn0pKFsgXSsuezEsMzB9KT8oWyBdKy57MSwzMH0pPyQiKTsKCQkgICAgaWYgKG1hdGNoLlN1Y2Nlc3MpCgkJICAgIHsKCQkgICAgICAgIHZhciBjYXAgPSBtYXRjaC5Hcm91cHM7CgkJICAgICAgICBvay5BZGQoJCJ7ZGlyfTt7Y2Fw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