Submitted by: Mohammad Sajid Anwar
You are given a string and a width.
Write a script to return the string that centers the text within that width using asterisks * as padding.
Input: $str = "Hi", $width = 5
Output: "*Hi**"
Text length = 2, Width = 5
Need 3 padding characters total
Left padding: 1 star, Right padding: 2 stars
Input: $str = "Code", $width = 10
Output: "***Code***"
Text length = 4, Width = 10
Need 6 padding characters total
Left padding: 3 stars, Right padding: 3 stars
Input: $str = "Hello", $width = 9
Output: "**Hello**"
Text length = 5, Width = 9
Need 4 padding characters total
Left padding: 2 stars, Right padding: 2 stars
Input: $str = "Perl", $width = 4
Output: "Perl"
No padding needed
Input: $str = "A", $width = 7
Output: "***A***"
Text length = 1, Width = 7
Need 6 padding characters total
Left padding: 3 stars, Right padding: 3 stars
Input: $str = "", $width = 5
Output: "*****"
Text length = 0, Width = 5
Entire output is padding
Submitted by: Mohammad Sajid Anwar
You are give a sentence.
Write a script to order words in the given sentence alphabetically but keeps the words themselves unchanged.
Input: $str = "The quick brown fox"
Output: "brown fox quick The"
Input: $str = "Hello World! How are you?"
Output: "are Hello How World! you?"
Input: $str = "Hello"
Output: "Hello"
Input: $str = "Hello, World! How are you?"
Output: "are Hello, How World! you?"
Input: $str = "I have 2 apples and 3 bananas!"
Output: "2 3 and apples bananas! have I"
Last date to submit the solution 23:59 (UK Time) Sunday 14th February 2026.