import java.util.Arrays;
public class Main {
public static void main
(String[] args
) { String s
= "1 34 5 23 7 89 32 4 10 3 6 5"; }
public static int[] string2array
(String s
) { return util1(s, 0, 0, false);
}
private static int[] util1
(String s,
int n,
int l,
boolean b
) { if (s.isEmpty()) {
return b ? util2(l, n, new int[l + 1]) : new int[l];
}
return b ? util2(l, n, util1(s.substring(1), 0, l + 1, false)) : util1(s.substring(1), 0, l, false);
}
return util1
(s.
substring(1), n
* 10 + Character.
digit(s.
charAt(0),
10), l,
true); }
private static int[] util2(int idx, int value, int[] array) {
array[idx] = value;
return array;
}
}
aW1wb3J0IGphdmEudXRpbC5BcnJheXM7CgpwdWJsaWMgY2xhc3MgTWFpbiB7CiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB7CiAgICAgICAgU3RyaW5nIHMgPSAiMSAzNCA1IDIzIDcgODkgMzIgNCAxMCAzIDYgNSI7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKEFycmF5cy50b1N0cmluZyhzdHJpbmcyYXJyYXkocykpKTsKICAgIH0KCiAgICBwdWJsaWMgc3RhdGljIGludFtdIHN0cmluZzJhcnJheShTdHJpbmcgcykgewogICAgICAgIHJldHVybiB1dGlsMShzLCAwLCAwLCBmYWxzZSk7CiAgICB9CgogICAgcHJpdmF0ZSBzdGF0aWMgaW50W10gdXRpbDEoU3RyaW5nIHMsIGludCBuLCBpbnQgbCwgYm9vbGVhbiBiKSB7CiAgICAgICAgaWYgKHMuaXNFbXB0eSgpKSB7CiAgICAgICAgICAgIHJldHVybiBiID8gdXRpbDIobCwgbiwgbmV3IGludFtsICsgMV0pIDogbmV3IGludFtsXTsKICAgICAgICB9CiAgICAgICAgaWYgKENoYXJhY3Rlci5pc1doaXRlc3BhY2Uocy5jaGFyQXQoMCkpKSB7CiAgICAgICAgICAgIHJldHVybiBiID8gdXRpbDIobCwgbiwgdXRpbDEocy5zdWJzdHJpbmcoMSksIDAsIGwgKyAxLCBmYW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