Reverse BWT by teebee

import java.util.*;enum W{W;System z;int i,L,l,c,x,n;{for(Scanner s=new Scanner(z.in);s==s;){char S[]=s.nextLine().toCharArray(),a;for(i=c=n=0;S[i++]>32;)n=n*10+S[i-1]%48;for(L=l=S.length-i;l>-1;c=x+1){for(x=a=0;(c-=a==S[i+x]?1:0)>0;a+=x>0?0:1)x=++x%L;if(n<0)z.out.print(l-->0?a:'\n');if(x==n)n=-1;}}}}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top