Skip to content

Instantly share code, notes, and snippets.

@TheBuzzSaw
Created March 19, 2019 15:08
Show Gist options
  • Select an option

  • Save TheBuzzSaw/ede88f22102ab87d69c1fb6e51ed9fa9 to your computer and use it in GitHub Desktop.

Select an option

Save TheBuzzSaw/ede88f22102ab87d69c1fb6e51ed9fa9 to your computer and use it in GitHub Desktop.
using System;
namespace LetterBox
{
class Program
{
static void Main(string[] args)
{
foreach (var arg in args)
{
var array = new char[arg.Length * 2 - 1];
array[0] = arg[0];
for (int i = 1; i < arg.Length; ++i)
{
int ii = i * 2;
array[ii - 1] = ' ';
array[ii] = arg[i];
}
Console.WriteLine(new string(array));
for (int i = 0; i < array.Length; ++i)
array[i] = ' ';
int last = arg.Length - 1;
for (int i = 1; i < last; ++i)
{
array[0] = arg[i];
array[array.Length - 1] = arg[last - i];
Console.WriteLine(new string(array));
}
array[0] = arg[last];
for (int i = 1; i < arg.Length; ++i)
array[i * 2] = arg[last - i];
Console.WriteLine(new string(array));
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment