Skip to main content
1 of 9
Denker
  • 6.9k
  • 1
  • 24
  • 67

Frame this nice ASCII-Art

#Introduction

I think everyone agrees that nice pictures have to have a nice frame. But most challenges on this site about ASCII-Art just want the raw picture and don't care about it's preservation.
Wouldn't it be nice if we had a program that takes some ASCII-Art and surrounds it with a nice frame?

#The Challenge

Write a program that takes some ASCII-Art as input and outputs it surrounded by a nice frame.

Example:

*****
 ***
  *
 ***
*****

becomes

╔═══════╗
║ ***** ║
║  ***  ║
║   *   ║
║  ***  ║
║ ***** ║
╚═══════╝
  • You have to use the exact same characters for the frame as in the example: ═ ║ ╔ ╗ ╚ ╝
  • The top and the bottom of the frame get inserted before the first and after the last line of the input.
  • The left and rights parts of the frame have to have exact one space padding to the widest line of the input.
  • There may be no leading or trailing whitespaces in the output. Only a trailing newline is allowed.
  • You may assume that the input has no unnecessary leading whitespaces.
  • You may assume that the input has no trailing whitespaces on any line.

#Rules

Happy Coding!

Using some great ASCII-Art, that was produced in any challenge on this site, as input to your program and showing it with a nice frame is highly encouraged!

Denker
  • 6.9k
  • 1
  • 24
  • 67