Posts

Showing posts from November, 2025

Robbie Hatley's Solutions, in Perl, for The Weekly Challenge #349 (“Power String” and “Meetings Point”)

Image
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, with a new pair of tasks each Monday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2025-11-24 through 2025-11-30 is #349. The tasks for challenge #349 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 349-1: Power String Submitted by: Mohammad Sajid Anwar You are given a string. Write a script to return the power of the given string. The power of the string is the maximum length of a non-empty substring that contains only one unique character. Example #1: Input: $str = "textbook" Output: 2 Breakdown: "t", "e", "x", "b", "oo", "k" The longest substring with one unique character is "oo". Example #2: Input: $str = "aaaaa" Output: 5 Example #3: Input: $str = "hoorayyy" Output: 3 Breakdown: "h"...

Robbie Hatley's Solutions, in Perl, for The Weekly Challenge #348 (“String Alike” and “Convert Time”)

Image
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, with a new pair of tasks each Monday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2025-11-17 through 2025-11-23 is #348. The tasks for challenge #348 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 348-1: String Alike Submitted by: Mohammad Sajid Anwar Write a script to find out whether a given string can be split into two halves of equal lengths, each with the same non-zero number of vowels. Example #1: Input: "textbook" Output: false 1st half: "text" (1 vowel) 2nd half: "book" (2 vowels) Example #2: Input: "book" Output: true 1st half: "bo" (1 vowel) 2nd half: "ok" (1 vowel) Example #3: Input: "AbCdEfGh" Output: true 1st half: "AbCd" (1 vowel) 2nd half: "EfGh" (1 vowel) Example #4: Input: "rhyt...

Robbie Hatley's Solutions, in Perl, for The Weekly Challenge #347 (“Format Date” and “Format Phone”)

Image
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, with a new pair of tasks each Monday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2025-11-10 through 2025-11-16 is #347. The tasks for challenge #347 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 347-1: Format Date Submitted by: Mohammad Sajid Anwar You are given a date in the form: 10th Nov 2025. Write a script to format the given date in the form: 2025-11-10 using the set below: @DAYS = ("1st", "2nd", "3rd", ....., "30th", "31st") @MONTHS = ("Jan", "Feb", "Mar", ....., "Nov", "Dec") @YEARS = (1900..2100) Example #1: Input: "1st Jan 2025" Output: "2025-01-01" Example #2: Input: "22nd Feb 2025" Output: "2025-02-22" Example #3: Input: "15th Apr...