Skip to main content
2 of 2
added 1 character in body
Caridorc
  • 27.6k
  • 7
  • 54
  • 135

This kind of task is well suited to Linq and functional programming, imperative code will only reinvent basic algorithms, so following @Topin suggestion, I suggest this outline:

public static string[] words(string text) 
{
    // Use of Regex and Split
}

public static string longestWord(string text)
{
    // Make use of words and OrderBy
}
Caridorc
  • 27.6k
  • 7
  • 54
  • 135