using System;
using System.Text.RegularExpressions;
class Program
{
public static void WordsStartWith(string str, string expr) {
MatchCollection mc = Regex.Matches(str, expr);
foreach (var word in mc)
Console.WriteLine(word);
}
static void Main() {
string str = "Stack C# sold net Safe c programming s saber S";
WordsStartWith(str, @"\bS\S*");
}
}
/*
run:
Stack
Safe
S
*/