From 06ae87c72d0857eb023684538b7311fd0f74386c Mon Sep 17 00:00:00 2001 From: "Ahmed M. Abd EL-latif" Date: Wed, 16 Feb 2022 07:36:52 +0200 Subject: [PATCH] length of last word --- LengthofLastWord.rb | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 LengthofLastWord.rb diff --git a/LengthofLastWord.rb b/LengthofLastWord.rb new file mode 100644 index 0000000..054940d --- /dev/null +++ b/LengthofLastWord.rb @@ -0,0 +1,4 @@ +def length_of_last_word(s) + x = s.split(" ") + return x.last.length +end \ No newline at end of file