A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Longest Word in Beef page! Here, you'll find the source code for this program as well as a description of how the program works.
using System;
namespace LongestWord;
class Program
{
public static void Usage()
{
Console.WriteLine("Usage: please provide a string");
Environment.Exit(0);
}
public static int LongestWord(StringView str)
{
int maxLen = 0;
for (StringView word in str.Split(' ', '\t', '\r', '\n'))
{
maxLen = Math.Max<int>(maxLen, word.Length);
}
return maxLen;
}
public static int Main(String[] args)
{
if (args.Count < 1 || args[0].Length < 1)
{
Usage();
}
int result = LongestWord(args[0]);
Console.WriteLine(result);
return 0;
}
}
Longest Word in Beef was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.