title: Expansion on given string according to number * contents of the parentheses
body: <p>I am trying to take a given string and when there is a number before parentheses then what's inside the parentheses gets repeated that number of times. I thought about using StringBuilder and built this function but I'm not sure how to get the inside of the parentheses repeated.
  example- 3(ab) - result would be ababab , example- 3(b(2(c))) result would be bccbccbcc
  in the function I built here it repeats the parentheses and not the contents of the parentheses.</p>
  <pre><code>  public static String solve(String s){
      StringBuilder sb = new StringBuilder();
      int repeat = 0;
      for (char c : s.toCharArray()) {
          if (Character.isDigit(c)) {
              repeat = repeat * 10 + Character.getNumericValue(c);
          } else {
              while (repeat &gt; 0) {
                  sb.append(c);
                  repeat--;
              }
              sb.append(c);
          }
      }
      return sb.toString();
      }
  }
  </code></pre>