class Ideone {
public static void main
(String args
[]) { int l = 0;
int r = 0;
while (l < str.length()) {
r = l;
while (r
< str.
length() && Character.
isDigit(str.
charAt(r
))) r
++; res
+= fill
(str.
charAt(l
- 1),
Integer.
parseInt(str.
substring(l, r
)) - 1); l = r;
} else {
res += str.charAt(l);
l++;
}
}
}
public static String fill
(char c,
int l
) { for(int i = 0; i < l; i++) {
res += c;
}
return res;
}
}
Y2xhc3MgSWRlb25lIHsKICAgCiAgCiAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmcgYXJnc1tdKSB7CiAgICAgIFN0cmluZyBzdHIgPSAiaDNqdjNzMTEiOwogICAgICBTdHJpbmcgcmVzID0gIiI7CiAgICAgIGludCBsID0gMDsKICAgICAgaW50IHIgPSAwOwogICAgICB3aGlsZSAobCA8IHN0ci5sZW5ndGgoKSkgewogICAgICAgICBpZihDaGFyYWN0ZXIuaXNEaWdpdChzdHIuY2hhckF0KGwpKSkgewogICAgICAgICAgICByID0gbDsKICAgICAgICAgICAgd2hpbGUgKHIgPCBzdHIubGVuZ3RoKCkgJiYgQ2hhcmFjdGVyLmlzRGlnaXQoc3RyLmNoYXJBdChyKSkpIHIrKzsKICAgICAgICAgICAgcmVzICs9IGZpbGwoc3RyLmNoYXJBdChsIC0gMSksIEludGVnZXIucGFyc2VJbnQoc3RyLnN1YnN0cmluZyhsLCByKSkgLSAxKTsKICAgICAgICAgICAgbCA9IHI7CiAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJlcyArPSBzdHIuY2hhckF0KGwpOwogICAgICAgICAgICBsKys7CiAgICAgICAgIH0KICAgICAgfQogICAgICBTeXN0ZW0ub3V0LnByaW50bG4ocmVzKTsKICAgfQogICAKICAgcHVibGljIHN0YXRpYyBTdHJpbmcgZmlsbChjaGFyIGMsIGludCBsKSB7CiAgICAgIFN0cmluZyByZXMgPSAiIjsKICAgICAgZm9yKGludCBpID0gMDsgaSA8IGw7IGkrKykgewogICAgICAgICByZXMgKz0gYzsKICAgICAgfQogICAgICByZXR1cm4gcmVzOwogICB9Cn0=