fork download
  1. class M{
  2. static String c(String s){
  3. String r = "",
  4. a[];
  5. for(String x : s.split("(?<=(\\d)(?!\\d))")){
  6. a = x.split("");
  7. for(int i = 0, j, l = a.length-1; i < l; i++){
  8. for(j = 0; j++ < new Short(a[l]); r += a[i]);
  9. }
  10. }
  11. return r;
  12. }
  13.  
  14. public static void main(String[] a){
  15. System.out.println(c("ab3c5"));
  16. System.out.println(c("a0b3"));
  17. System.out.println(c("13b1"));
  18. System.out.println(c("a13b1"));
  19. System.out.println(c("a123b1"));
  20. System.out.println(c("aa2a1b1"));
  21. System.out.println(c("123"));
  22. }
  23. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
aaabbbccccc
bbb
111b
aaa111b
aaa111222b
aaaaab
111222