using System.Collections.Generic;
public static void Main()
string data = "Peanutbutterandjelly.";
Console.WriteLine("Running StringSplit()");
Console.WriteLine("\nI: {0}", data);
Console.WriteLine("Solution: \n{0}", FCharToUpper(StringSplit(data)));
public static string FCharToUpper(string s)
if (string.IsNullOrEmpty(s))
return char.ToUpper(s[0]) + s.Substring(1);
private static string StringSplit(string s)
var dictionary = new Dictionary<string, int>()
{{"peanut", 001}, {"butter", 002}, {"and", 003}, {"jelly", 004}, {".", 005}, {"yuck", 006}, {"!",007}};
List<string> newS = new List<string>();
Console.WriteLine("The String appears to contain no words.");
for (int i = 0; i <= size; i++)
for (int j = i + 1; j <= size; j++)
if (dictionary.ContainsKey(s1.Substring(i, j - i)))
newS.Add(s1.Substring(i, j - i));
newString = string.Join(" ", newS.ToArray());