Swap The Characters

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

Each line of input will be in two parts. The first part will be a sequence of unique, printable character (excluding SPACE), and the second part will be a list of character pairs separated by spaces. Example input:

abcd ab cd

'abcd' is the first part, 'ab cd' the second. The task is to make the swap indicated by each pair of characters in the second part.

Example output:

badc

Additional info: a pair of AA or == changes nothing because the character swaps with itself.

Options

exec is denied

now post-mortem time, all source codes will be revealed

Sample input:_

abcd ab cd

Sample output:

badc

Sample input:_

WelLdh0r|_o Wh do
abcdefghijklmnopqrstuvwxyz az by cx dw ev fu gt hs ir jq kp lo mn
0123456789 01 23 45 67 89

Sample output:

helLoW0r|_d
zyxwvutsrqponmlkjihgfedcba
1032547698

Sample input:_

}`HIyDhuxLMcTS^P@ ^h c} TS
1<rV8vx20#{O4s$ xx ss {4 Vx 8r v# Ov <s 4v x4 2v
%/|;8atO{(PRv PP %| (8 Pa /{ {/ (|
Y5d8kteA^\v" 5e ke dv 8t ev
znw.C@3g 3n n3 Cn wz @w
*H'JC!}+ !J J' 'C *H !J CH HJ '*
oHpCg}Y#mwkyIQ:t7j 7Q ko tC
WifYrIMp,O3Hu2 MO uu MH if Wi Yi fu iM Wf
?WC/@V.hYNKScT$P ?S cT ?h YS NS CV C? .K ?/ KK $c
8/<BO"6>*2 <O << 8/ >* <" 8O <>
HEh*Szj-figvV>tk!5 f> hE H* Hv zv tt jV vz
8@qS\h$z,{gkX# kh {h h@ Sk SX z, {k k\ qX h,
+~Lxcb8q=_D 8_ bc bb
VbNaBs3c?{=4 =? ={ cb
7^gYnNua~T(*q u( *g *Y
g&az[tX$2 a$ t[ [X za z$ [[ [X
XE~nh"OQk' ~X Qk kn Qk h" Ek
-~Z*2/{}_ ~/ 2/ /Z }{
w`X.7T+G?WMDYR"H .. MW ?G TR ?R R7 WM ?" T" wD .G RR
ec'51OBj 11 B1 5O OB 'e ec c5
;^[!`iB& !i ;^ i;
(Fw!~|Z},7O !~ ,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.+JYQ^;?M]f
{o!T0zWN?|Q}h1Lj#)
%{8i`GdqyamueUX
KxMhy|5z=a#;8X29\^
UG>v}l2b
kUJ#FS=sTw&
ZMS;G[6%p<]ulyg&r!
>5S]Zt@PxDrLw,A'
tV-;Q`RX[xKB
I8-sWG!^,OXB0'xHnA
8>(M*9U^?&LZSFH|
6el3$B'A
5lGAU6~>Sn72
/,vXQ5V+
j~sE^u'D\pyILQmKZ=
!1BC&ThF8l
KO`-A$2\[NqT}
L?xQT='FqO}\/vKRA
bAFs&([CaHcfUYelK0
ITw@AF3!<5Sy;"

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1leonid560.03702014/10/14 04:24:240B / 31B / 23B
2Histocrat620.03982014/10/13 10:46:310B / 31B / 26B
3mitchs620.03882014/10/13 14:14:560B / 31B / 26B

Perl _

RankUserSizeTimeDateStatistics
1tybalt89490.04022014/10/20 00:47:220B / ?B / ?B
2teebee490.04792014/10/25 22:36:540B / 19B / 26B
3tails560.06502014/10/27 00:32:180B / 17B / 30B

Python _

RankUserSizeTimeDateStatistics
1twobit (alternative)860.09032014/10/23 01:03:040B / ?B / ?B
2leonid860.08942014/10/25 15:45:240B / 51B / 23B
3twobit870.09812014/10/15 07:26:470B / ?B / ?B
4hallvabo870.09592014/10/15 07:29:330B / ?B / ?B
5rolf1120.09332014/10/14 07:15:030B / 65B / 34B

Lua _

RankUserSizeTimeDateStatistics
1twobit1060.03802014/10/15 08:15:490B / 55B / 44B

C _

RankUserSizeTimeDateStatistics
1nu(rand)910.03192014/10/23 02:59:150B / 48B / 43B
2tails920.03352014/10/27 06:39:570B / 50B / 42B
3nu930.03212014/10/23 01:59:580B / 50B / 43B
4llhuii1010.03222014/10/22 22:58:120B / 48B / 52B
5twobit1080.03222014/10/22 23:01:580B / 54B / 54B
6chocobi1220.03232014/10/19 22:37:450B / 59B / 61B
7tails900.03182014/10/27 07:08:390B / 49B / 41B

Haskell _

RankUserSizeTimeDateStatistics
1henkma780.03582014/10/24 21:07:540B / 47B / 30B
2int-e780.03652014/10/25 11:21:130B / 47B / 31B
3oerjan(less clever, thus shorter. Bah!)840.03612014/10/18 23:25:200B / 49B / 32B
4oerjan850.03482014/10/18 01:19:530B / 54B / 30B

Java _

RankUserSizeTimeDateStatistics
1teebee1800.63262014/10/23 08:33:271B / 95B / 78B
2twobit1830.26262014/10/23 00:46:220B / 116B / 59B
3fatO1830.25902014/10/23 02:26:590B / 116B / 59B
4empitax2360.24432014/10/22 05:58:320B / 157B / 70B

AWK _

RankUserSizeTimeDateStatistics
1llhuii920.04552014/10/22 23:08:070B / 39B / 52B
2llhuii(tails)720.03302014/10/27 23:08:280B / 34B / 36B

sed _

RankUserSizeTimeDateStatistics
1tails500.04732014/10/27 06:29:360B / 7B / 34B
2teebee600.06762014/10/14 05:54:210B / 12B / 44B

xgawk _

RankUserSizeTimeDateStatistics
1llhuii920.04452014/10/22 23:13:190B / 39B / 52B

Brainfuck _

RankUserSizeTimeDateStatistics
1mitchs2060.16852014/10/18 18:35:460B / 0B / 206B

GolfScript _

RankUserSizeTimeDateStatistics
1tails270.42622014/10/17 22:49:550B / 4B / 22B
2blinry330.16352014/10/26 17:56:000B / 8B / 24B

gs2 _

RankUserSizeTimeDateStatistics
1whio190.27952014/10/21 07:12:427B / 8B / 3B
2recursive190.50812015/09/29 15:44:026B / 7B / 4B

Vim _

RankUserSizeTimeDateStatistics
1udioica340.32392016/12/03 08:46:562B / ?B / ?B

Language Ranking_

RankLangUserSizeScore
1gs2whio1910000
2GolfScripttails277037
3Vimudioica345588
4Perltybalt89493877
5sedtails503800
6Rubyleonid563392
7AWKllhuii(tails)722638
8Haskellhenkma782435
9Pythontwobit (alternative)862209
10Ctails902111
11xgawkllhuii922065
12Luatwobit1061792
13Javateebee1801055
14Brainfuckmitchs206922

return to the top page