Problem:
Print a Rectangle

Draw a rectangle which has a height of H cm and a width of W cm. Draw a 1-cm square by single '#'.

Input

The input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space.

The input ends with two 0 (when both H and W are zero).

Output

For each dataset, print the rectangle made of H × W '#'.

Print a blank line after each dataset.

Constraints

1 ≤ H ≤ 300

1 ≤ W ≤ 300

Sample Input

3 4
5 6
2 2
0 0

Sample Output

####
####
####

######
######
######
######
######

##
##

Solution in JAVA (judge verdict: Accepted)

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner stdIn = new Scanner(System.in)) {
			Rectangle rectangle = new Rectangle();
			while (true) {
				int h = stdIn.nextInt();
				int w = stdIn.nextInt();
				if (h > 300 || w > 300) {
					throw new RuntimeException("Input Error:range 0 to 300");
				}
				if (h == 0 && w == 0) {
					break;
				}
				rectangle.setChar('#');
				rectangle.draw(h, w);
				System.out.println("");
			}
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
	}
}

final class Rectangle {
	private Character displayChar = '*';

	/**
	 * Set a character to draw shape
	 * @param displayChar a character
	 */
	protected void setChar(Character displayChar) {
		this.displayChar = displayChar;
	}

	/**
	 * Draw square
	 * @param height Height of square
	 * @param width Width of square
	 */
	protected void draw(int height, int width) {
		if (height < 0 || width < 0) {
			throw new RuntimeException("Input Error:Minus value input");
		}
		for (int i = 1; i <= height; i++) {
			for (int j = 1; j <= width; j++) {
				System.out.print(this.displayChar);
			}
			System.out.println("");
		}
	}
}