Given two integers n and m, print a hollow rectangle star pattern of the given n rows and m columns. In this pattern, stars (*) are printed on the boundary of the rectangle, while the inner area contains spaces.
The pattern can be printed using two nested loops. The outer loop iterates through the rows, and the inner loop iterates through the columns. A star (*) is printed when the current position is on the first row, last row, first column, or last column; otherwise, a space is printed.