Transposition

Transpose the input data. Change the row into columns.

IN

123
456
789

OUT

147
258
369

IN

qwer
asdf
zxcv

OUT

qaz
wsx
edc
rfv

IN

!@#$%^&*()

OUT

!
@
#
$
%
^
&
*
(
)
Login to submit solution


4 symbols pyth
Mon Sep 19 17:36:40 2016 Sait2000
jC.z
45 symbols bash
Mon Jul 25 03:58:21 2016 hidefromkgb
t=`cat`;fold -w1<<<"$t"|pr -T`wc -l<<<"$t"`JS
49 symbols perl
Mon Aug 25 04:39:28 2014 gabrielmad
#!/usr/bin/perl -nl
my$i;$x[$i++][$.-1]=$_ for/./g}{print@$_ for@x
52 symbols perl
Sun Jun 22 12:28:30 2014 avkhozov
#!/usr/bin/perl -nl
my$x;map$r[$x++][$.-1]=$_,split//}{print@$_ for@r
54 symbols haskell
Wed Mar 18 11:07:06 2015 YoshikuniJujo
import Data.List
main=interact$unlines.transpose.lines
56 symbols python2
Mon Aug 11 15:05:46 2014 xsot
import sys
for i in zip(*list(sys.stdin)):print`i`[2::5]
61 symbols perl
Fri Jan 10 16:23:41 2014 bugov
map{$b[$i++][$j]=$_ for split//;$i=0;$j++}<>;print@$_,$/for@b
64 symbols perl
Fri Dec 27 17:20:55 2013 vlet
#!/usr/bin/perl -p0
/^(.+)/;$x=1+length$1;$a["@-"%$x].=$&while/./g;$_=join"\n",@a
72 symbols perl
Fri Dec 27 17:12:54 2013 vlet
#!/usr/bin/perl -p0
/^(.+)(\n|$)/;$x=length($1)+1;$a["@-"%$x].=$&while/./g;$_=join"\n",@a
91 symbols python2
Wed Jan 14 02:50:32 2015 beched
import sys
print '\n'.join([''.join(x)for x in zip(*sys.stdin.read().strip().split('\n'))])
102 symbols perl
Fri Dec 27 15:42:05 2013 avkhozov
#!/usr/bin/perl  -naF//
++$i;${$m}[$i]=[@F]}{for $i(0 .. $#{$m->[1]}){for $j(1 .. $#{$m}){print ${$m}[$j][$i];}print$/;}
103 symbols perl
Fri Dec 27 15:39:12 2013 Bay <>
#!/usr/bin/perl  -naF//
++$i;${$m}[$i]=[@F]}{for $i(0 .. $#{$m->[1]}){for $j(1 .. $#{$m}){print ${$m}[$j][$i];}print $/;}
109 symbols perl
Fri Dec 27 02:28:11 2013 Logioniz
#!/usr/bin/perl  -naF//
++$i;${$m}[$i]=[@F]}{$a=$#{$m->[1]};for $i(0 .. $a){for $j(1 .. $#{$m}){print ${$m}[$j][$i];}print $/;}
126 symbols python3
Fri Feb 7 11:54:34 2014 maksim
import sys
print('\n'.join([''.join(s) for s in map(list, zip(*[[c for c in S.strip()] for S in sys.stdin]))]).strip(),end='')
164 symbols perl
Fri Dec 27 02:00:06 2013 Logioniz
#!/usr/bin/perl  -naF//
++$i;${$m}[$i]=[@F]}
{
$a = $#{$m->[1]};
for $i (0 .. $a) {
        for $j (1 .. $#{$m}) {
                print ${$m}[$j][$i];
        }
        print $/;
}

View all solutions