C, 259 231 Bayt
Golf Kodu
#define v a[1][i
i,k,l,x,h,w;main(char*s,char**a){for(;v];w+=2*!x,s=v++],h=x>h?x:h)x=(s==v])*(x+1);h++;s=malloc((x=h++*++w+1)+w);memset(s,32,h*w);for(i=k;v];s[x+1]=s[x]=k=v++],x=k==v]?x-w:(h-1)*w+l++*2+3)s[i*w]=10;printf("%s",s);}
Ayrıntılı Kod
//Variable Explanations:
//i - increment through argument string, must beinitialized to 0
//k - increment through argument string, must be initialized to 0
//l - record x coordinate in return value, must be initialized to 0
//x - record the actual character position within the return string
//arrheight - the height of the return string
//arrwidth - the width of the return string
//arr - the return string
//argv - the string containing the arguments
#define v argv[1][i
i,k,l,x,arrheight,arrwidth;
main(char*arr,char**argv){
for(;v]; //For Length of input
arrwidth+=2*!x, //increment width by 2 if this char is not the same as the last
arr=v++], //set arr to current char
arrheight=x>arrheight?x:arrheight //see if x is greater than the largest recorded height
)x=(arr==v])*(x+1); //if this character is the same as the last, increment x (using arr to store previous char)
arrheight++; //increment height by one since its 0 indexed
arr=malloc((x=arrheight++*++arrwidth+1)+arrwidth); //create a flattened array widthxheight and set x to be the bottom left position
memset(arr,32,arrheight*arrwidth); //fill array with spaces
for(i=k;v]; //For Length of input
arr[x+1]=arr[x]=k=v++], //set x and x+1 positions to the current character, store current character in i
x=k==v]?x-arrwidth:(arrheight-1)*arrwidth+l++*2+3 //if next char is same as current move vertically, else set x to bottom of next column
)arr[i*arrwidth]=10; //Add new lines to string at end of width
printf("%s",arr); //output string
}
GCC ile derlenmiş, özel Bayrak yok
Düzenle
Adelphus sayesinde 28 byte kurtarıldı. Değişimi bir tanım oluşturmamı sağladı. Ve döngüleri yeniden düzenleyerek 2 bayttan tasarruf etmek için süre döngülerine girdim. Ayrıca girdideki son karakter singleton olmadığı zaman kodun kırılacağı problemini de düzelttim. Yalnızca bir benzersiz harf varsa kod başarısız olur, ancak diğer tüm durumlarda da çalışması gerekir.