written in c#, get the logic and do the same in vb, you may find many online code converters to convert c# to vb
using System;
using System.Linq;
namespace CP
{
class Program
{
static void Main(string[] args)
{
string input = "----------56628885466----655277772323777---";
string[] parts = input.Split(new char[] { '-' }, StringSplitOptions.None);
string final = "";
foreach (string part in parts)
{
if (part == "")
final += "-";
else
{
var max = part.Max();
string temp = part;
foreach (char c in part)
{
if (c != max)
temp = temp.Replace(c, '-');
}
string temp1 = "";
foreach (string item in temp.Split('-'))
{
if (item == "")
temp1 += item;
else
temp1 += GetMiddle(item);
}
final += temp1;
}
}
Console.WriteLine(final);
}
private static string GetMiddle( string item)
{
var a = item.Length / 2;
string temp = "";
for (int i = 0; i < item.Length; i++)
{
if (i == a)
temp += item[0];
else
temp += "-";
}
return temp;
}
}
}