Skip to content

Instantly share code, notes, and snippets.

@manwar
Last active March 27, 2025 16:51
Show Gist options
  • Save manwar/701344c2fa51a15dea0f83a789ef141d to your computer and use it in GitHub Desktop.
Save manwar/701344c2fa51a15dea0f83a789ef141d to your computer and use it in GitHub Desktop.
The Weekly Challenge - 317

The Weekly Challenge - 317

Early Bird Club members ONLY

Task 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"
Output: false

Task 2: Friendly Strings

Submitted by: Mohammad Sajid Anwar

You are given two strings.

Write a script to return true if swapping any two letters in one string match the other string, return false otherwise.

Example 1

Input: $str1 = "desc", $str2 = "dsec"
Output: true

Example 2

Input: $str1 = "fuck", $str2 = "fcuk"
Output: true

Example 3

Input: $str1 = "poo", $str2 = "eop"
Output: false

Example 4

Input: $str1 = "stripe", $str2 = "sprite"
Output: true


Last date to submit the solution 23:59 (UK Time) Sunday 20th April 2025.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment