package leetcode;

/**
 * https://leetcode.com/problems/decoded-string-at-index/
 */
public class Problem880 {
    public String decodeAtIndex(String S, int K) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem880 prob = new Problem880();
        System.out.println(prob.decodeAtIndex("leet2code3", 10)); // o
        System.out.println(prob.decodeAtIndex("ha22", 5)); // h
        System.out.println(prob.decodeAtIndex("a2345678999999999999999", 1)); // a
        System.out.println(prob.decodeAtIndex("hello23", 10)); // o
    }
}

@@ -167,35 +167,474 @@
     
-// TODO%0A        return null
+String answer = %22%22;%0A        for (int i = 0; i %3C S.length(); i++) %7B%0A            if (S.charAt(i) %3E= 'a' && S.charAt(i) %3C= 'z') %7B%0A                answer += S.charAt(i);%0A            %7D else %7B%0A                int repeat = S.charAt(i) - '0';%0A                String tmp = %22%22;%0A                for (int j = 0; j %3C repeat; j++) %7B%0A                    tmp += answer;%0A                %7D%0A                answer = tmp;%0A            %7D%0A        %7D%0A        return %22%22 + answer.charAt(K - 1)
 ;%0A  
@@ -727,16 +727,18 @@
 m880();%0A
+//
         
@@ -796,24 +796,26 @@
  10)); // o%0A
+//
         Syst
@@ -866,16 +866,18 @@
 ); // h%0A
+//
         
@@ -919,43 +919,28 @@
 ex(%22
-a2345678999999999999999
+hello23
 %22, 1
+0
 )); // 
-a
+o
 %0A   
@@ -983,36 +983,51 @@
 tIndex(%22
-hello23
+a2345678999999999999999
 %22, 1
-0
 )); // 
-o
+a
 %0A    %7D%0A%7D

Update problem 880