import java.awt.event.ItemEvent;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Concatenate_Numbers {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str = br.readLine();
int N = 1;
int index =0;
while(true){
String temp = String.valueOf(N);
for (int j = 0; j < temp.length(); j++) {
int cur = str.charAt(index)-'0';
if(cur==temp.charAt(j)-'0'){
index++;
}
if(index==str.length()){
System.out.println(N);
return;
}
}
N++;
}
}
}
이문제는 가상의 수 N을 하나씩 증가시키면서 나열된숫자와 한자리씩 비교하는 방식으로 풀어야 한다.
검정색이 지워진 수이고, N을 1부터 하나씩 증가시켜가며,
N이 빨간색 숫자를 포함하고 있으면, 다음 빨간색 숫자를 비교한다.