Codeforces Round #724 (Div. 2)B. Prinzessin der Verurteilung
给一个字符串s, 求字典序最小的字符串没有在s中出现.
这题就是bfs按个试..妈的, 比赛的时候想多了. 浪费时间
package readman;
import net.egork.io.InputReader;
import net.egork.io.OutputWriter;
import java.util.*;
public class TaskB {
public void solve(int testNumber, InputReader in, OutputWriter out) {
int n = in.readInt();
String s = in.readString();
List<String> list = new ArrayList<>();
list.add("");
while (true) {
int size = list.size();
for (int i = 0; i < size; i++){
if (list.size() > 1 && list.get(i) == "")
continue;
for (int j = 0; j < 26; j++) {
String ss = list.get(i) + (char) ('a' + j);
if (!s.contains(ss)){
out.printLine(ss);
return;
}
list.add(ss);
}
}
}
}
}