using System; using System.Text; using System.Text.RegularExpressions; public class Test { public static void Main() { // Paste the raw follows with names and IDs into the input below. var followsRaw = new StringBuilder(); int iChar; while ((iChar = Console.Read()) != -1) { followsRaw.Append(Convert.ToChar(iChar)); } string pattern = @"(?\d+)\s{3,}"; var rgx = new Regex(pattern); MatchCollection matches = rgx.Matches(followsRaw.ToString()); var followIDs = new StringBuilder(); foreach (Match m in matches) { followIDs.Append(m.Groups["ID"].Value); followIDs.Append(", "); } if (matches.Count > 0) { // Remove trailing comma and print. followIDs.Length -= 2; Console.Write(followIDs.ToString()); } else { Console.WriteLine("Input could not be read."); } } }