Calculator Community > Community Contests

[ENDED] Code Golf - The Reboot #1

<< < (5/5)

Adriweb:
Ah if I knew about grep -o ... :P
ggwp

JWinslow23:

--- Quote from: pimathbrainiac on June 08, 2015, 08:25:18 am ---To keep the OP uncluttered, no, but PM me and I'll give you the requested solution.

--- End quote ---
Actually, what I did was put the code in a table, with [ spoiler ] tags with the code inside. For example, taken at random from a pre existing contest:

Java
RankUserSizeDateCode132981898/29/2014 12:16:14 PMSpoiler For Spoiler: class G{public static void main(String[]s){String o="";int p=0;for(char c:"code".toCharArray()){p=s[0].toLowerCase().indexOf(c,p);if(p<0){o="0";break;}o=o+(p+1)+"\n";}System.out.print(o);}}2pimathbrainiac2688/25/2014 6:57:57 PMSpoiler For Spoiler: import java.util.Arrays;public class C7{public static void main(String[] args){String s=Arrays.toString(args);int a,b,c,d;a=s.indexOf('c')-1;b=s.indexOf('o')-1;if(b>a){c=s.indexOf('d')-1;if(c>b){d=s.indexOf('e')-1;if(d>c){System.out.print(a+"\n"+b+"\n"+c+"\n"+d);}}}}}
Maybe you should do that.

Juju:
Yep, what @JWinslow23 said.

Also, had I known about rev in Bash, I could have about 33 bytes...

Navigation

[0] Message Index

[*] Previous page

Go to full version