diff options
Diffstat (limited to 'challenge-331/eric-cheung/python/ch-1.py')
| -rwxr-xr-x | challenge-331/eric-cheung/python/ch-1.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/challenge-331/eric-cheung/python/ch-1.py b/challenge-331/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..a7d0dcd351 --- /dev/null +++ b/challenge-331/eric-cheung/python/ch-1.py @@ -0,0 +1,12 @@ +
+import re
+
+## strInput = "The Weekly Challenge" ## Example 1
+## strInput = " Hello World " ## Example 2
+strInput = "Let's begin the fun" ## Example 3
+
+strOutput = re.sub(r"\s+", " ", strInput).strip()
+
+arrOutput = [strLoop for strLoop in strOutput.split(" ") if strLoop]
+
+print (len(arrOutput[-1]))
|
