We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b13b55b commit 233e57cCopy full SHA for 233e57c
archive/r/r/longest-word.R
@@ -0,0 +1,13 @@
1
+longest_word_length <- function(input_string) {
2
+ # Checking input
3
+ args <- commandArgs(trailingOnly = TRUE)
4
+
5
+ if (length(args) == 0 || args == "") {
6
+ cat("Usage: please provide a string\n")
7
+ } else {
8
+ # Split the string by whitespace and find the maximum word length in one line
9
+ cat(max(nchar(unlist(strsplit(args[1], "[ \t\n\r]+")))), "\n")
10
+ }
11
+}
12
13
+longest_word_length()
0 commit comments