60. Hollow Square Photo Frame

Acceptance — 0 accepted 0 submissions

Easy
ConditionalsNested LoopsPatterns
No companies listed
A photo frame has a border but is empty inside. Print an N × N square where the border is made of stars and the inside is spaces.

Input Format
A single integer N.

Output Format
Print N lines of exactly N characters. Border cells are '*' and inner cells are spaces.

Constraints
• 1 ≤ N ≤ 50

Example 1

Input
4
Output
****
*  *
*  *
****

Explanation The first and last rows are full. Middle rows have stars only at the edges.

Example 2

Input
1
Output
*

Explanation A 1 × 1 frame is just one star.

Example 3

Input
2
Output
**
**

Explanation A 2 × 2 frame has no inside, so all stars.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
**** * * * * ****
No results yet
Run your code to test it against the sample cases.
Problem List