using System;
namespace Application
{
class Functions
{
public static int rotate(string[] args)
{
if (args.Length < 1) {
Console.WriteLine("{0} args provided; expected {1}.",args.Length,1);
return -1;
}
int numberOfStrings;
if (!(int.TryParse(args[0], out numberOfStrings)))
{
Console.WriteLine("First argument must be an integer.");
return -1;
}
if (numberOfStrings != args.Length - 1)
{
Console.WriteLine("{0} strings expected, but only {1} strings were found.",
numberOfStrings, args.Length - 1);
return -1;
}
int is_max = 0;
for (int currentColumn = 1; currentColumn <= numberOfStrings; currentColumn++)
{
string stringToRotate = args[currentColumn];
char[] targetAsChars = stringToRotate.ToCharArray();
if (targetAsChars.Length > is_max)
{
is_max = targetAsChars.Length;
}
for (int idx = 0; idx < targetAsChars.Length; idx++)
{
Console.CursorLeft = currentColumn - 1;
Console.WriteLine(targetAsChars[idx]);
}
Console.CursorTop = Console.CursorTop - targetAsChars.Length;
}
Console.CursorTop = Console.CursorTop + is_max;
return 0;
}
}
class EntryPoint
{
static int Main(string[] args)
{
return Functions.rotate(args);
}
}
}