The Banach–Tarski Paradox
Pyth, 21 bytes
#++Jw*4d.rJ".,?*&$@!%
Try it online: Demonstration
Finally a use-case for .r
.
Explanation
#++Jw*4d.rJ".,?*&$@!%
# infinite loop
Jw read a string from input and store it in J
*4d 4 spaces
.rJ".,?*&$@!% rotate the chars of J using this char order
++ combine the 3 strings (J, spaces, rotated) and print
The infinite loop breaks, when there is no more input available.
Ruby, 65
10.times{b=gets;puts b.chop.tr(',?*&$@!%.','.,?*&$@!%')+' '+b}
Works great when input is taken from a file instead of stdin:
ruby banach.rb < ball.txt
On the other hand, if you like typing in balls to stdin manually, and want the output at the end, try this 67-byte version:
puts (0..9).map{b=gets;b.chop.tr(',?*&$@!%.','.,?*&$@!%')+' '+b}
Matlab, 120
Matlab is not the greatest language for handling strings. \n
is always considered as two characters, which is quite annoying, and you cannot just make a matrix out of a line-breaked (line-broken?) string, you have to do it manually. At least I did not have to care about the size/padding as every line has the exact same length.
a='.,?*&$@!%.';b=input('');b(b>90)=[];b=reshape(b',22,10)';c=b;for k=1:9;c(b==a(k))=a(k+1);end;disp([b,ones(10,4)*32,c])
Example Input:
' ########## \n ###@%$*.&.%%!### \n ##!$,%&?,?*?.*@!## \n ##&**!,$%$@@?@*@&&## \n#@&$?@!%$*%,.?@?.@&@,#\n#,..,.$&*?!$$@%%,**&&#\n ##.!?@*.%?!*&$!%&?## \n ##!&?$?&.!,?!&!%## \n ###,@$*&@*,%*### \n ########## '
Example output:
########## ##########
###@%$*.&.%%!### ###!.@&,$,..%###
##!$,%&?,?*?.*@!## ##%@?.$*?*&*,&!%##
##&**!,$%$@@?@*@&&## ##$&&%?@.@!!*!&!$$##
#@&$?@!%$*%,.?@?.@&@,# #!$@*!%.@&.?,*!*,!$!?#
#,..,.$&*?!$$@%%,**&&# #?,,?,@$&*%@@!..?&&$$#
##.!?@*.%?!*&$!%&?## ##,%*!&,.*%&$@%.$*##
##!&?$?&.!,?!&!%## ##%$*@*$,%?*%$%.##
###,@$*&@*,%*### ###?!@&$!&?.&###
########## ##########
PS: If I can assume the input this way:
[' ########## ',' ###@%$*.&.%%!### ',' ##!$,%&?,?*?.*@!## ',' ##&**!,$%$@@?@*@&&## \n#@&$?@!%$*%,.?@?.@&@,#','#,..,.$&*?!$$@%%,**&&#',' ##.!?@*.%?!*&$!%&?## ',' ##!&?$?&.!,?!&!%## ',' ###,@$*&@*,%*### ',' ########## ']
I only need 88 characters:
a='.,?*&$@!%.';b=input('');c=b;for k=1:9;c(b==a(k))=a(k+1);end;disp([b,ones(10,4)*32,c])