Longest Word in Julia

Published on 09 November 2024 (Updated: 09 November 2024)

Welcome to the Longest Word in Julia page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

function longest_word_length(text::String)
    # Split on exactly the specified whitespace characters: space, tab, newline, carriage return
    words = split(text, r"[ \t\n\r]+")
    
    # Find the maximum length of the words array
    return maximum(length.(words))
end

# Command-line argument handling
if length(ARGS) == 0 || strip(ARGS[1]) == ""
    println("Usage: please provide a string")
    exit(1)
end

input_string = ARGS[1]
println(longest_word_length(input_string))

Longest Word in Julia was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.