File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -8,18 +8,18 @@ public String decodeString(String s) {
88 StringBuilder sb = new StringBuilder ();
99
1010 while (idx < sLen ) {
11- int idxOfFirstLetter = idx ;
11+ int idxOfFirstLetter = idx ;
1212 while (idx < sLen && !(s .charAt (idx ) >= '0' && s .charAt (idx ) <= '9' )) {
1313 idx ++;
1414 }
15+ sb .append (s .substring (idxOfFirstLetter , idx ));
1516
16- int idxOfFirstDigit = idx ;
17- while (idx < sLen && s .charAt (idx ) != '[' ) {
18- idx ++;
19- }
20-
21- sb .append (s .substring (idxOfFirstLetter , idxOfFirstDigit ));
22- if (idx < sLen ) {
17+ if (idx < sLen ) {
18+ int idxOfFirstDigit = idx ;
19+ while (idx < sLen && s .charAt (idx ) != '[' ) {
20+ idx ++;
21+ }
22+
2323 int factor = Integer .valueOf (s .substring (idxOfFirstDigit , idx ));
2424
2525 idx ++;
@@ -46,4 +46,4 @@ public String decodeString(String s) {
4646
4747 return sb .toString ();
4848 }
49- }
49+ }
You can’t perform that action at this time.
0 commit comments