Robbie Hatley’s Solutions, in Perl, for The Weekly Challenge #399: (“Longest Repeating Character” and “Longest Absolute Path”)
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 2026-11-09 through 2026-11-15 is #399. The tasks for this challenge are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 399-1: Longest Repeating Character Submitted by: Mohammad Sajid Anwar You are given a string str and an integer k > 0. Write a script to choose any character of str and change it to another character. You may perform this operation up to k times. Return the length of the longest reachable substring of a single letter. Musical accompaniment: Paul McCartney's "Long And Winding Road". To solve this problem, I'll generate every substring of the string, then calculate the aomac (Abundance Of Most-Abundant Character) for each substring. Then if length - aomac is less-than-or-equal-to...