Skip to main content
Commonmark migration
Source Link

#Java, 127 111 88 bytes

Java, 127 111 88 bytes

(s,r)->{for(int i=0;i++<s.length();)r+=i%2<1?new StringBuffer(s).reverse():s;return r;};

#Ungolfed test program

Ungolfed test program

    public static void main(String[] args) {
    BiFunction<String, String, String> func = (s, r) -> {
        for (int i = 0; i++ < s.length();) {
            r += i % 2 < 1 ? new StringBuffer(s).reverse() : s;
        }
        return r;
    };
    System.out.println(func.apply("Hello!", ""));
}

#Java, 127 111 88 bytes

(s,r)->{for(int i=0;i++<s.length();)r+=i%2<1?new StringBuffer(s).reverse():s;return r;};

#Ungolfed test program

    public static void main(String[] args) {
    BiFunction<String, String, String> func = (s, r) -> {
        for (int i = 0; i++ < s.length();) {
            r += i % 2 < 1 ? new StringBuffer(s).reverse() : s;
        }
        return r;
    };
    System.out.println(func.apply("Hello!", ""));
}

Java, 127 111 88 bytes

(s,r)->{for(int i=0;i++<s.length();)r+=i%2<1?new StringBuffer(s).reverse():s;return r;};

Ungolfed test program

    public static void main(String[] args) {
    BiFunction<String, String, String> func = (s, r) -> {
        for (int i = 0; i++ < s.length();) {
            r += i % 2 < 1 ? new StringBuffer(s).reverse() : s;
        }
        return r;
    };
    System.out.println(func.apply("Hello!", ""));
}
deleted 41 characters in body
Source Link
Shaun Wild
  • 2.5k
  • 18
  • 26

#Java, 127 111111 88 bytes

(s,r)->{StringBuilder b = new StringBuilder(s).reverse();forfor(int i=0;i++<s.length();)r+=br+=i%2<1?new StringBuffer(s).reverse();return:s;return r;};

#Ungolfed test program

    public static void main(String[] args) {
 
        BiFunction<String, String, String> func = (s, r) -> {
        StringBuilder b = new StringBuilder(s).reverse();
        for (int i = 0; i++ < s.length();) {
            r += bi % 2 < 1 ? new StringBuffer(s).reverse(); : s;
        }
        return r;
    };
 
    System.out.println(func.apply("Hello!", ""));
}

#Java, 127 111 bytes

(s,r)->{StringBuilder b = new StringBuilder(s).reverse();for(int i=0;i++<s.length();)r+=b.reverse();return r;};

#Ungolfed test program

    public static void main(String[] args) {
 
        BiFunction<String, String, String> func = (s, r) -> {
        StringBuilder b = new StringBuilder(s).reverse();
        for (int i = 0; i++ < s.length();) {
            r += b.reverse();
        }
        return r;
    };
 
    System.out.println(func.apply("Hello!", ""));
}

#Java, 127 111 88 bytes

(s,r)->{for(int i=0;i++<s.length();)r+=i%2<1?new StringBuffer(s).reverse():s;return r;};

#Ungolfed test program

    public static void main(String[] args) {
    BiFunction<String, String, String> func = (s, r) -> {
        for (int i = 0; i++ < s.length();) {
            r += i % 2 < 1 ? new StringBuffer(s).reverse() : s;
        }
        return r;
    };
    System.out.println(func.apply("Hello!", ""));
}
Source Link
Shaun Wild
  • 2.5k
  • 18
  • 26

#Java, 127 111 bytes

(s,r)->{StringBuilder b = new StringBuilder(s).reverse();for(int i=0;i++<s.length();)r+=b.reverse();return r;};

#Ungolfed test program

    public static void main(String[] args) {

        BiFunction<String, String, String> func = (s, r) -> {
        StringBuilder b = new StringBuilder(s).reverse();
        for (int i = 0; i++ < s.length();) {
            r += b.reverse();
        }
        return r;
    };

    System.out.println(func.apply("Hello!", ""));
}