From c6127cc921f1979b5de488f52cf8fb8a758dba4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Khoa=20Hu=E1=BB=B3nh=20=28Daniel=29?= Date: Mon, 1 Apr 2024 12:43:18 +0700 Subject: [PATCH] Create main.go --- solution/58/main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 solution/58/main.go diff --git a/solution/58/main.go b/solution/58/main.go new file mode 100644 index 0000000..55a4fb6 --- /dev/null +++ b/solution/58/main.go @@ -0,0 +1,10 @@ +package main + +import ( + "strings" +) + +func lengthOfLastWord(s string) int { + words := strings.Fields(strings.TrimSpace(s)) + return len(words[len(words)-1]) +}