fork(4) download
  1. class M{
  2. static String c(String[] a){
  3. String r = a[0],
  4. z[] = a[1].split(" ?-");
  5. for(int i = 0; i < z.length; r = r.replace(z[i], a[2].split(" ?[+]")[i++]));
  6. return r;
  7. }
  8.  
  9. public static void main(String[] a){
  10. System.out.println(c(new String[]{ "Hello world", "-wo -ld", "+Ea +th" }));
  11. System.out.println(c(new String[]{ "Hello World", "-wo -ld", "+Ea +th" }));
  12. System.out.println(c(new String[]{ "Hello", "-llo", "+y" }));
  13. System.out.println(c(new String[]{ "Red", "-R -d", "+Gr +en" }));
  14. System.out.println(c(new String[]{ "mississippi", "-is -i", "+lz +p" }));
  15. System.out.println(c(new String[]{ "Football", "-o -a", "+a +i" }));
  16. System.out.println(c(new String[]{ "mississippi", "-is -i", "+iz +p" }));
  17. }
  18. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
Hello Earth
Hello Worth
Hey
Green
mlzslzspppp
Fiitbill
mpzspzspppp