https://leetcode.com/problems/decode-string/public class Solution { private String s; private int newPos; public String decodeString(String ins) { s = '.' + ins + ']'; newPos = 0; String outStr = impl(1, 0); return outStr.substring(1, outStr.length()); } private String impl(int prefix, int startPos) { int base = 0; String baseStr = ""; String outStr = ""; for (int i=startPos; i