Posts

Showing posts from April, 2025

Robbie Hatley's Solutions, in Perl, for The Weekly Challenge #319 (“Word Count” and “Minimum Common”)

Image
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, with a new pair of taks each Monday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2025-04-28 through 2025-05-04 is #319 The tasks for challenge #319 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 319-1: Word Count Submitted by: Mohammad Sajid Anwar You are given a list of words containing alphabetic characters only. Write a script to return the count of words either starting with a vowel or ending with a vowel. Example #1: Input: @list = ("unicode", "xml", "raku", "perl") Output: 2 The words are "unicode" and "raku". Example #2: Input: @list = ("the", "weekly", "challenge") Output: 2 Example #3: Input: @list = ("perl", "python", "postgres") Output: 0 I'll interpret ...

Robbie Hatley's Solutions, in Perl, for The Weekly Challenge #318 (“Group Positions” and “Reverse Equals”)

Image
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, with a new pair of taks each Monday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2025-04-21 through 2025-04-27 is #318 The tasks for challenge #318 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 318-1: Group Position Submitted by: Mohammad Sajid Anwar You are given a string of lowercase letters. Write a script to find the position of all groups in the given string. Three or more consecutive letters form a group. Return "" if none found. Example #1: Input: $str = "abccccd" Output: "cccc" Example #2: Input: $str = "aaabcddddeefff" Output: "aaa", "dddd", "fff" Example #3: Input: $str = "abcdd" Output: "" I find the examples (which print group contents) to contradict the problem description (which asks ...

Robbie Hatley's Solutions, in Perl, for The Weekly Challenge #317 (Theme: “Friendly Acronyms”)

Image
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, with a new pair of taks each Monday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2025-04-14 through 2025-04-20 is #317 The tasks for challenge #317 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 317-1: Acronyms Submitted by: Mohammad Sajid Anwar You are given an array of words and a word. Write a script to return true if concatenating the first letter of each word in the given array matches the given word, return false otherwise. Example #1: Input: @array = ("Perl", "Weekly", "Challenge") $word = "PWC" Output: true Example #2: Input: @array = ("Bob", "Charlie", "Joe") $word = "BCJ" Output: true Example #3: Input: @array = ("Morning", "Good") $word = "MM" Out...

Robbie Hatley's Solutions, in Perl, for The Weekly Challenge #316 (Theme: “Sequences”)

Image
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, with a new pair of taks each Monday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2025-04-07 through 2025-04-13 is #316. The tasks for challenge #316 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 316-1: Circular Submitted by: Mohammad Sajid Anwar You are given a list of words. Write a script to find out whether the last character of each word is the first character of the following word. Example #1: Input: @list = ("perl", "loves", "scala") Output: true Example #2: Input: @list = ("love", "the", "programming") Output: false Example #3: Input: @list = ("java", "awk", "kotlin", "node.js") Output: true I find the title puzzling, because examples 1 and 3 give output as being "true" e...