[Question]
  [
Coders are always trying to flatten arrays into boring 1-dimensional entities and it makes me sad.
Your task is to unflatten an arbitrary string of characters, outputting a lovely city skyscape.
Consider the string: `aaabbbbbccqrrssstttttttPPw`
It looks much better like this:
```
            tt
            tt
  bb        tt
  bb        tt
aabb      sstt
aabbcc  rrssttPP
aabbccqqrrssttPPww
```
(Ok, yes, the letters are duplicated to make it look more city-skyline-ery).
Take an input string, duplicate each subsection of matching characters (not necessarily alphabetic letters) and build me a city!
Shortest code bytes win.
I actually thought I had the requirements nailed, but to answer some questions:
* it must be on the ground
* you can have extra sky if you want (leading blank lines, surrounding blank space) - but not between the buildings
* letters can be reused inside the string (same architecture, different location)
* the letters are assumed to be ASCII, but more flair will be given to those supporting additional encodings (UTF8, etc)
  
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 6 bytes
```
γ€DζR»
```
[Try it online!](https://tio.run/##MzBNTDJM/f//3OZHTWtczm0LOrT7///ExMQkEEhOLiwqKiouLi6BgICAcgA "05AB1E – Try It Online")
In a version newer than the challenge, `ζ` has been added as a replacement fo `.Bø` 
# [05AB1E](https://github.com/Adriandmen/05AB1E), 8 bytes
```
γ€D.BøR»
```
Explanation:
```
γ            Convert into a list of consecutive equal elements
 €D          Duplicate each element
   .B        Squarify; pad each element with spaces so that they are the length of the longest element
     ø       Transpose
      R      Reverse (otherwise the city would be upside-down)
       »     Join by newlines
```
[Try it online!](https://tio.run/##MzBNTDJM/f//3OZHTWtc9JwO7wg6tPv//8TExCQQSE4uLCoqKi4uLoGAgIByAA "05AB1E – Try It Online")
[Answer]
# [CJam](https://sourceforge.net/p/cjam), 23 bytes
```
qe`::*:__:,:e>f{Se[}zN*
```
[Try it online!](https://tio.run/##S85KzP3/vzA1wcpKyyo@3krHKtUurTo4Nbq2yk/r///ExMQkEEhOLiwqKi4uLoGAgIByAA "CJam – Try It Online")
Explanation:
```
qe`::*:__:,:e>f{Se[}zN* Accepts (multi-line?) input
q                       Take all input
 e`::*                  Split into groups of equal elements
      :_                Duplicate each
        _:,:e>          Push maximal length without popping
              f{Se[}    Left-pad each to that length with space strings (NOT space chars, although not a problem here)
                    z   Zip
                     N* Join with newlines
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 9 bytes
```
Œgx'2z⁶ṚY
```
[Try it online!](https://tio.run/##y0rNyan8///opPQKdaOqR43bHu6cFfn////ExMQkEEhOLiwqKiouLi6BgICAcgA "Jelly – Try It Online")
Explanation:
```
Œgx'2z⁶ṚY  Main Link
Œg         Group runs of equal elements
  x        Repeat
   '              the lists
    2                       twice without wrapping
     z⁶    Zip (transpose), filling in blanks with spaces
       Ṛ   Reverse the whole thing so it's upside-down
        Y  Join by newlines
```
[Answer]
# [Python 3](https://docs.python.org/3/), ~~155~~ ~~136~~ ~~134~~ 132 bytes
*-19 bytes thanks to @LeakyNun*  
*-2 bytes thanks to @officialaimm*  
*-1 byte thanks to @Wondercricket*
```
s=input()+'+'
k=' '*len(s)
a=[]
c=b=''
while s:
 while c in b:b+=c;c,*s=s
 a+=b+k,b+k;b=c
for r in[*zip(*a)][:0:-1]:print(*r,sep='')
```
[Try it online!](https://tio.run/##JYw7CsMwEAV7nUKdfg4kpJPZO7g3LqTFwcJGVnYVTHJ5xSEDD6Z4THnXZc/31hhSLq@qjVNOiRWUVHabs2YjAoyTQIiglDiWtM2SvZB/Q5myjD46wB47y8BCBgfRrd25PgKKx06SzttoP6loG8w0@qu/3CZfKOWqLXU8lzNuWgshxB@ITyJi5vpnGI4v "Python 3 – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), 117 bytes
```
import re
s=input()
for l in zip(*[x+S*len(s)for x,_ in re.findall(r'((.)\2*)',s)for S in'  '])[::-1]:print''.join(l)
```
[Try it online!](https://tio.run/##JcpBDoIwEEDRPafobqaITWRJ4h1IWCIxFSGOqdM6rRG9fJXwt@@HT7p5rnOmR/CSlExFPBKHV0JdzF6UU8TqSwHLftl1pZsYo15hqc4ryWRm4qt1DgUQjT7VpYZqe7r/AUrBoPum2R@GJghxAjB3T4xO5wzW2svaOD5FYoxpq23f8AM "Python 2 – Try It Online")
[Answer]
# Java 8, ~~412~~ ~~400~~ ~~330~~ ~~324~~ ~~312~~ 319 bytes
-6 bytes thanks to VisualMelon  
-12 bytes thanks to Kevin Cruijssen  
but +19 bytes because I forgot to include the imports in the byte count.
```
import java.util.*;x->{Map m=new HashMap(),n;int l=x.length(),i=l,v,y,h=0,d=1;char c,k;for(;i-->0;m.put(c,d=m.get(c)!=null?d+1:1),h=d>h?d:h)c=x.charAt(i);for(y=h;y>0;y--){n=new HashMap(m);for(i=0;i<l;i++)if(n.get(k=x.charAt(i))!=null){v=(int)m.get(k);System.out.print((y>v?"  ":k+""+k)+(i==l-1?"\n":""));n.remove(k);}}}
```
[Try it online!](https://tio.run/##VZDBcsIgEIbveQqaEzQJo1cpOr314owzHq0HJGgwhKSwiWYyefaUqId2L7DL7vcv/1V0IqsbZa95OemqqR2ga6jRFrSh7yySRniPtkLbIdIWlDsLqRAoD0PU1TpHDu/BaXtBd8KiMWrak9ESeRAQjkdHFYZfTYcjEu7iCRqiGYEA8emerYetaFDFrbqhL@GLkGGSWhb0kOF3apS9QBFKmpu0S/u04Is050smC@GQTEt2rh1mOsvWC1bRpgUsw3tFLyrcyBu3rTGbPFmuliTM5utik68KIgN6JnwC1uSB6HnB@sDos4wM9t8@1bND8wXTH4bpJCH6jO1DovwLesmRoeM4fIA8tygJ2/ceVEXrFmgTvACM@3W3iRGKV2USx0lJkoDnJltu4m8br@KYEGapU1XdqRkwjiObgDo8W3hYHB9@j9MkhDjNIeWPc957eMZud/sF)
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-R`](https://codegolf.meta.stackexchange.com/a/14339/), ~~19~~ ~~18~~ ~~15~~ ~~13~~ ~~12~~ 9 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
Includes trailing spaces on each line.
```
ò¦ Õ®m²ÃÔ
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LVI&code=8qYg1a5tssPU&input=ImFhYWJiYmJiY2NxcnJyc3NzdHR0dHR0dFBQdyI)
```
ò¦ Õ®m²ÃÔ     :Implicit input of string
ò             :Partition by
 ¦            :  Inequality
   Õ          :Transpose
    ®         :Map
     m        :  Map
      ²       :    Duplicate
       Ã      :End map
        Ô     :Reverse
              :Implicit output joined with newlines
```
[Answer]
# Mathematica, 150 bytes
```
(z=Characters[v=#];f=CharacterCounts[v][#]&/@(d=Union@z);Row[Column/@Map[PadLeft[#,Max@f,""]&,Table[Table[d[[i]]<>d[[i]],f[[i]]],{i,Length@d}],{1}]])&
```
[Answer]
# [R](https://www.r-project.org/), 135 bytes
```
e=rle(sub('(.)','\\1\\1',strsplit(scan(,''),'')[[1]]));write(sapply(sum(e$l|1):1,function(x)ifelse(e$l>=x,e$v,'  ')),'',sum(e$l|1),,'')
```
[Try it online!](https://tio.run/##RYw7CsMwEESv4sKwu7AE1CY4Z3Bvu5CFDAJFcbTyJ5C7KxIpMsxUw3sxZ9tFb1G2GQEvBAzjqEqBJUVZvUsoRgdkAKobBjVNRLcjulQwva7@XegH2tZ/FF0VL1swyT0DnuQW68XW696dbNudoWmAqoj/DFdv1lrPNca8YhSR9EvfH/kL "R – Try It Online")
reads from stdin, writes to stdout (with a trailing newline).
### Explanation:
* `rle` finds the lengths of the streaks of characters, the heights of each tower.
* the `sub` expression replaces each character with its double (so I didn't have to muck about with setting adjacent indices together)
* `sapply` returns an array (in this case a matrix):
	+ `sum(e$l|1)` is the number of distinct characters; we go from top to bottom
	+ `ifelse( ... )` is a vectorized `if...else` allowing us to build a matrix of towers and double spaces
	+ `write` writes to console, with a few options to format.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 13 bytes
```
j_.tsC*2]*Mr8
```
[Try it online!](http://pyth.herokuapp.com/?code=j_.tsC%2a2%5D%2aMr8&input=%22aaabbbbbccqrrssstttttttPPw%22&debug=0)
[Answer]
# [PHP](https://php.net/), 138 bytes
```
for(;~$s=&$argn;$s=substr($s,$r++%2*$i))for($i=0;$i<strspn($s,$c=$s[0]);$f[$i++][$r]=$c)a&$f[$i]?:$f[$i]=" ";krsort($f);echo join("
",$f);
```
[Try it online!](https://tio.run/##JYpBDoIwFET3nII0I2kti8aln4aDkC6QiFQT2vyPW69eEVczee/lJZeuz0uuK4z8WL1yTlGZE2v6QHxzUNqfvG@ysYa0YGtPlzOiMb8O0TtC7HYreT2CyUMGFwxhHhCtDQM4eExmbA4S@ut/vaoVvVgSbxqzofu0pPqZ4qpVpdofKeUL "PHP – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), 15 bytes
```
'(.)\1*'XXtvc!P
```
[**Try it online!**](https://tio.run/##y00syfn/X11DTzPGUEs9IqKkLFkxACiQmJiYBALJyYVFRcXFxSUQEBBQrg4A "MATL – Try It Online")
### Explanation
```
'(.)\1*' % Push string to be used as regexp pattern
XX       % Implicit input. Regexp matching. Pushes row cell array of matching substrings
t        % Duplicate
v        % Concatenate vertically
c        % Convert to char. This reads cells in column-major order (down, then across)
         % and produces a 2D char array, right-padding with spaces
!        % Transpose
P        % Flip vertically. Implicitly display
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 40 bytes:
```
Ａ⟦⟦ω⟧⟧λＦθ¿⁼ι§§λ±¹¦⁰⊞§λ±¹ι⊞λ⟦ι⟧ＦλＦ²↑⁺⪫ιω¶
```
[Try it online!](https://tio.run/##dY2xDoIwFEVn@YqG6b2kJOooE4ODDobFCRlqKdCkKdJXxL@vRcLoXe5wb86RvXByECaEgkh3FqpqrmvODOZJOzgGIyY73TI4j5MwBJqzwl9soz6wteHspjrhFRwQOdsjIisn6v8ddCQqQ2o9xbHS9WYzyH59jAinrYfT/RWNTQPXQdvFPkdC@rApYh6CEOK5RMrROSLya8pyDtk7ZGS@ "Charcoal – Try It Online") Link is to verbose version of code. I originally tried a simple loop over the input string to print an oblong every time the letter changed, but I switched to this list-building method as it saved 5 bytes. Explanation: The variable `l` contains a nested list of the input letters. Characters that match the current last list elements get pushed onto the last list otherwise a new sublist is created for that character. It then remains to join the letters in each sublist so that they can be printed vertically twice.
[Answer]
# [QuadS](https://github.com/abrudz/QuadRS), 15 + 1 = 16 bytes
+1 byte for the `1` flag.
```
⊖⍵
(.)\1*
2/⍪⍵M
```
[Try it online!](https://tio.run/##KyxNTCn@//9R17RHvVu5NPQ0Ywy1uIz0H/WuAvJ9//9PTExMAoHk5MKiouLi4hIICAgo/28IAA "QuadS – Try It Online")
`⊖⍵` post-process by flipping upside down
`(.)\1*` runs of identical characters
`2/⍪⍵M` duplicate the columnified **M**atch
The `1` flag causes the results to be merged together.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 116 bytes
```
->s{a=s.scan(/(.)(\1*)/).map{|x,y|[x,y.size+1]}.to_h
m=a.values.max
m.times{|i|puts a.map{|k,v|v+i<m ?'  ':k*2}*''}}
```
[Try it online!](https://tio.run/##JYtLDoIwFAD3nKK78vMRXBqrV2CPxDwIxAaqyCsI0p69YpjFrGaGsVxcI9zhQisKAqrw6Sc@BP4tDYMkAIX9auZ4MfkmIPmto7SwoF/3h6cEwoTdWNOWzZ4CLVVNq5GmHzUx3Oc2nswUybNiV84YP7Xh0YacW@uanCNi@aeq3sNARHonyz68cD8 "Ruby – Try It Online")
[Answer]
# C, ~~259~~ 231 Bytes
## Golfed Code
```
#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);}
```
## Verbose Code
```
//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
}
```
Compiled with GCC, no special Flags
### Edit
Saved 28 bytes thanks to adelphus. His change allowed me to create a define. And I made the while loops into for loops to save 2 bytes each by rearranging the loop. I also fixed an issue where the code would break when the last character in input wasn't singleton. The code will fail if there is only one unique letter but should work in all other cases.
[Answer]
# [Factor](https://factorcode.org/) + `grouping.extras sequences.repeating`, 94 bytes
```
[ [ ] group-by values dup longest length '[ _ 32 pad-head ] map 2 repeat flip [ print ] each ]
```
Modern Factor doesn't require a conversion to string before printing a sequence of code points, so have a screenshot of running the quotation in the listener:
[![enter image description here](https://i.stack.imgur.com/tRPUy.png)](https://i.stack.imgur.com/tRPUy.png)
Here's a TIO link with the extra `>string`:
[Try it online!](https://tio.run/##RY07C8JAEIR7f8WQxsoUsVOwFRsJiFUQWS@bB553l92Lj18fT1I4xQwLO/M1ZKKX6Xw6HPcbtOLH0Ls253cUUpCqN4o7i2ML5WFkZ1jRyOd/5cKBKaYaNEoKRe@xXSwyIrr9ZMwgoqpxVlm@sqlChcsMXN0@eJId03A9BljvWtYIy66NHZYVrlgXCFSvOqY6tR4UUGDGorF9SFu7mY2QPKYfJtPhMhmydvoC "Factor – Try It Online")
## Explanation:
It's a quotation (anonymous function) that takes a string as input and outputs to standard output. Assuming `"aaabbbbbccqrrssstttttttPPw"` is on the data stack when this quotation is called...
* `[ ] group-by values` Split into groups of equal elements.
**Stack:** `{ V{ 97 97 97 } V{ 98 98 98 98 98 } V{ 99 99 } V{ 113 } V{ 114 114 } V{ 115 115 115 } V{ 116 116 116 116 116 116 116 } V{ 80 80 } V{ 119 } }`
* `dup longest length` Keep the 'city' on the stack but also find the length of the longest 'building.'
**Stack:** `~city~ 7`
* `'[ _ 32 pad-head ] map` Pad the city with whitespace to be a rectangular matrix.
**Stack:** `{ V{ 32 32 32 32 97 97 97 } V{ 32 32 98 98 98 98 98 } V{ 32 32 32 32 32 99 99 } V{ 32 32 32 32 32 32 113 } V{ 32 32 32 32 32 114 114 } V{ 32 32 32 32 115 115 115 } V{ 116 116 116 116 116 116 116 } V{ 32 32 32 32 32 80 80 } V{ 32 32 32 32 32 32 119 } }`
* `2 repeat` Repeat each row twice.
* `flip` Transpose the matrix.
* `[ print ] each` Print each row to standard output.
[Answer]
# [J](http://jsoftware.com/), 22 bytes
```
2|.@|:@#[[;.1~1,2~:/\]
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/jWr0HGqsHJSjo631DOsMdYzqrPRjYv9rcnGlJmfkK6QpqCcmJiaBQHJyYVFRcXFxCQQEBJSr/wcA "J – Try It Online")
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 22 bytes
21 bytes of code, +1 for `-l` flag.
```
Ya@`(.)\1*`RV:yWVyZDs
```
[Try it online!](https://tio.run/##K8gs@P8/MtEhQUNPM8ZQKyEozKoyPKwyyqX4////ujn/ExMTk0AgObmwqKi4uLgEAgICygE "Pip – Try It Online")
### Explanation
```
                       a is 1st cmdline arg; s is space (implicit)
 a@`(.)\1*`            Using regex, create list of runs of same character in a
Y                      Yank that into y variable
              yWVy     Weave (interleave) y with itself to duplicate each item
                  ZDs  Zip to transpose, with a default character of space filling gaps
           RV:         Reverse the resulting list (with the compute-and-assign
                        meta-operator : being abused to lower the precedence)
                       Auto-print, one sublist per line (implicit, -l flag)
```
[Answer]
# Haskell, 144 bytes
```
f s=let x=groupBy(==)s;l=length;m=maximum(map l x)in concatMap(++"\n")$reverse$transpose$concat[[z,z]|z<-(map(\y->y++(replicate(m-(l y))' '))x)]
```
I'm pretty confident I can do better than this, but this is the best I can come up with for the time being.
[Answer]
# [Stacked](https://github.com/ConorOBrien-Foxx/stacked), 42 bytes
```
[rle toarr[...*chars]map FIX 2*tr rev out]
```
[Try it online!](https://tio.run/##Ky5JTM5OTfn/P7ooJ1WhJD@xqChaT09PKzkjsag4NjexQMHNM0LBSKukSKEotUwhv7Qk9r@DVRoXl3piYmISCCQnFxYVFRcXl0BAQEC5ukLafwA "Stacked – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), 107 bytes
```
gets.gsub(/(.)(\1*)/,'\0
'*2).split('
').map{|x|x.ljust($_.size).chars}.transpose.reverse.map{|x|puts x*""}
```
[Try it online!](https://tio.run/##LctNCsIwEEDhfU8hRcgPMlVP0gMUyiSEWqkaZyYatT17VPTbvNWj5B6lDEEYBk5ONxqM7nbWNBvVbStl9wY4TqNoVSkDJ4yvOc8ZpmNi0eseeHwGA/6AxAsI4ZnjhQNQuAX69D/EJLzKtq6XUhDRfXl/JWJm@Wnb@xs "Ruby – Try It Online")
a full program which assumes there will be no newlines in the string.
[Answer]
# [JavaScript (V8)](https://v8.dev/), 98 bytes
```
x=>x.replace(/(.)\1*/g,y=>s=s.replace(/$/mg,_=>y[i]+y[i--]||'  ',i=n),s=`
`.repeat(n=x.length))&&s
```
[Try it online!](https://tio.run/##RYqxDoIwFAB3v4IQA62WEjeXxzewq5FnUyqmFuxrEBL@vUocvOGWuweOSMp3QyjGY2whTlBN0uvBotKsZJKfD7vSiBkqAvqHbfk04grVfOou@6@K4rIseZLkogPHBUGzadZbY2AOJmm1M@HOeZZRVL2j3mppe8NaliLibUWpl/dEFH7U9TvlPH4A "JavaScript (V8) – Try It Online")
# [JavaScript (V8)](https://v8.dev/), 100 bytes
```
x=>x.replace(/(.)\1*/g,(y,c)=>s=s.replace(/$/mg,_=>y[i--]?c+c:'  ',i=n),s=`
`.repeat(n=x.length))&&s
```
[Try it online!](https://tio.run/##RcpBDoIwEEDRvacgxECrpcSdMRm8Ans1UielYGrBToNw@hriwrf9/6kmRej7MRTTMbYQZ6hm6fVoFWpWMsmvh11pBFsEcqgI6B@35cuIO1TLpS@K2xn3eMqTJBc9OC4Imk2zvloF5mCWVjsTOs6zjCIOjgarpR0Ma1mqlHqsEN/eE1H4qetPynn8Ag "JavaScript (V8) – Try It Online")
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 37 bytes
```
{⊃,/⍵↑⍨¨-⌈/≢¨⍵}'(.)\1*'⎕S{2/⍪⍵.Match}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///3zmzpPJR24TqR13NOvqPerc@apv4qHfFoRW6j3o69B91Ljq0AihYq66hpxljqKX@qG9qcLURUN0qoKieb2JJckYtxAwF9cTExCQQSE4uLCoqLi4ugYCAgHJ1AA "APL (Dyalog Unicode) – Try It Online")
[Answer]
# q/kdb+, 53 bytes
**Solution:**
```
{(|)(+)(,/)(max(#:)each c)$(+)2#(,)c:((&)differ x)_x}
```
**Example:**
```
 q){(|)(+)(,/)(max(#:)each c)$(+)2#(,)c:((&)differ x)_x}"BBPPPPxxGGGGKKKKKKKkkkkEEeeEEEeeEEEEEOOO8####xxXXX"
 "        KK                      "
 "        KK                      "
 "        KK          EE          "
 "  PP  GGKKkk        EE    ##    "
 "  PP  GGKKkk    EE  EEOO  ##  XX"
 "BBPPxxGGKKkkEEeeEEeeEEOO  ##xxXX"
 "BBPPxxGGKKkkEEeeEEeeEEOO88##xxXX"
```
**Explanation:**
```
{reverse flip raze (max count each c)$flip 2#enlist c:(where differ x)_x} / ungolfed function
{                                                                       } / lambda function
                                                      (where differ x)    / indices where x differs
                                                                      _   / cut at these points aabbbc -> "aa","bbb","c"
                                                    c:                    / save in variable c
                                             enlist                       / put this list in another list
                                           2#                             / take two from this list (duplicate)
                                      flip                                / rotate columns/rows
                   (max count each c)                                     / find the longest run of characters
                                     $                                    / whitespace pad lists to this length
              raze                                                        / reduce down lists
         flip                                                             / rotate columns/rows
 reverse                                                                  / invert so buildings are on the ground
```
[Answer]
# [Perl 5](https://www.perl.org/), 92 + 1 (-p) = 93 bytes
```
while(s/(.)\1*//){$a[$_].=($"x($i-length$a[$_])).$1x2for 1..length$&;$i+=2}say while$_=pop@a
```
[Try it online!](https://tio.run/##LYzRCsIgFEB/ZcQltPA6B3sKoR8I9l4xbKwmyDSvsEX06xm1zuM5cEIfXZ3zNFjXM5IM@UltpORPMEdoz6gZrGYGVrh@vKVhsZwjqLm6@lgoxH9Z78BudfUi8yh@O2h18GFvcjbGXL503T1GIkoLTTO9fUjWj5TFocZSlVmEDw "Perl 5 – Try It Online")
]