Submitted by: Mohammad Sajid Anwar
You are given a string and a positive integer.
Write a script to format the string, removing any dashes, in groups of size given by the integer. The first group can be smaller than the integer but should have at least one character. Groups should be separated by dashes.
Input: $str = "ABC-D-E-F", $i = 3
Output: "ABC-DEF"
Input: $str = "A-BC-D-E", $i = 2
Output: "A-BC-DE"
Input: $str = "-A-B-CD-E", $i = 4
Output: "A-BCDE"
Submitted by: Mohammad Sajid Anwar
You are given an array of integers.
Write a script to return an array of the ranks of each element: the lowest value has rank 1, next lowest rank 2, etc. If two elements are the same then they share the same rank.
Input: @ints = (55, 22, 44, 33)
Output: (4, 1, 3, 2)
Input: @ints = (10, 10, 10)
Output: (1, 1, 1)
Input: @ints = (5, 1, 1, 4, 3)
Output: (4, 1, 1, 3, 2)
Last date to submit the solution 23:59 (UK Time) Sunday 25th May 2025.