C#4.0、329 320 307バイト
using System;class P{static void Main(){Func<char,dynamic>f=(d)=>Console.ReadLine().Split(d);var c=f(' ')[0][0];var m=0;var l=new string[9999][];var z=0;for (l[z]=f(c);l[z].Length==2;l[z]=f(c)){m=Math.Max(l[z][0].Length,m);z++;}for(var i=0;i<z;i++){Console.WriteLine("{0,"+m+"}"+c+"{1}",l[i][0],l[i][1]);}}}
非ゴルフバージョン:
using System;
class P
{
static void Main()
{
// lamba to to read a line and split on a char, returns an array of
Func<char,dynamic>f=(d)=>Console.ReadLine().Split(d);
// read the separator char by taking the first char of the first string
// in the array
// use our lambda
var c=f(' ')[0][0];
var m=0; // max position where char is found
var l=new string[9999][]; // hold all input
var z=0; // count valid entries in l
// loop until the input doesn't contain an
// array with 2 elements
// here we use our lambda agian, twice
for (l[z]= f(c);l[z].Length==2;l[z] = f(c))
{
// calculate max, based on length
// of first element from the string array
m=Math.Max(l[z][0].Length,m);
z++; // increase valid items
}
// loop over all valid items
for(var i=0;i<z;i++)
{
// use composite formatting with the padding option
// use the max to create a format string, when max =4
// and seperator char is , this will give
// "{0,4},{1}"
Console.WriteLine("{0,"+ m +"}"+c+"{1}",l[i][0],l[i][1]);
}
}
}
最大9999行を受け入れます...