solving this question in edabit: https://edabit.com/challenge/XRAGxXj4KtakkvD3F using a nice swap method
it wasn't that bad, i just had to figure out how to implement the swap method
import java.util.Arrays;
public class Challenge {
public static String unmix(String str) {
String unmixedString = "";
char[] c = str.toCharArray();
for(int i = 0; i < c.length; i++) {
if(i % 2 == 0 && i != c.length - 1)
swap(c, i);
unmixedString += c[i];
}
return unmixedString;
}
private static void swap(char[] c, int i) {
char temp = c[i];
c[i] = c[i + 1];
c[i + 1] = temp;
}
}