fork download
  1. import java.util.*;
  2. import java.io.*;
  3. public class Main
  4. {
  5. static ArrayList<String> arr = new ArrayList<>();
  6. static void gen()
  7. {
  8. for(int i = 0; i<26; i++)
  9. {
  10. arr.add(nextChar(i)+"");
  11. }
  12.  
  13. for(int i = 0; i<26; i++)
  14. {
  15. for(int j = 0; j<26; j++)
  16. {
  17. arr.add(nextChar(i)+""+nextChar(j));
  18. }
  19. }
  20.  
  21. for(int i = 0; i<26; i++)
  22. {
  23. for(int j = 0; j<26; j++)
  24. {
  25. for(int k = 0; k<26; k++)
  26. {
  27. arr.add(nextChar(i)+""+nextChar(j)+""+nextChar(k));
  28. }
  29. }
  30. }
  31.  
  32. // Collections.sort(arr);
  33. }
  34.  
  35. static char nextChar(int n)
  36. {
  37. return (char)(n+'a');
  38. }
  39.  
  40. public static void main(String[] args) throws IOException
  41. {
  42. // Scanner read = new Scanner(System.in);
  43. Reader read = new Reader();
  44.  
  45. gen();
  46. // for(int i = 0; i<100; i++)
  47. // {
  48. // System.out.println(arr.get(i));
  49. // }
  50. int tc = read.nextInt();
  51. for(int cs = 1; cs<=tc; cs++)
  52. {
  53. int n = read.nextInt();
  54. String s = read.readLine();
  55.  
  56. for(int i = 0; i<arr.size(); i++)
  57. {
  58. if(!s.contains(arr.get(i)))
  59. {
  60. System.out.println(arr.get(i));
  61. break;
  62. }
  63. }
  64. }
  65. }
  66. }
  67.  
  68. class Reader
  69. {
  70. final private int BUFFER_SIZE = 1 << 16;
  71. private DataInputStream din;
  72. private byte[] buffer;
  73. private int bufferPointer, bytesRead;
  74.  
  75. public Reader()
  76. {
  77. din = new DataInputStream(System.in);
  78. buffer = new byte[BUFFER_SIZE];
  79. bufferPointer = bytesRead = 0;
  80. }
  81.  
  82. public Reader(String file_name) throws IOException
  83. {
  84. din = new DataInputStream(new FileInputStream(file_name));
  85. buffer = new byte[BUFFER_SIZE];
  86. bufferPointer = bytesRead = 0;
  87. }
  88.  
  89. public String readLine() throws IOException
  90. {
  91. byte[] buf = new byte[10000]; // line length
  92. int cnt = 0, c;
  93. while ((c = read()) != -1)
  94. {
  95. if (c == '\n')
  96. break;
  97. buf[cnt++] = (byte) c;
  98. }
  99. return new String(buf, 0, cnt);
  100. }
  101.  
  102. public int nextInt() throws IOException
  103. {
  104. int ret = 0;
  105. byte c = read();
  106. while (c <= ' ')
  107. c = read();
  108. boolean neg = (c == '-');
  109. if (neg)
  110. c = read();
  111. do
  112. {
  113. ret = ret * 10 + c - '0';
  114. } while ((c = read()) >= '0' && c <= '9');
  115.  
  116. if (neg)
  117. return -ret;
  118. return ret;
  119. }
  120.  
  121. public long nextLong() throws IOException
  122. {
  123. long ret = 0;
  124. byte c = read();
  125. while (c <= ' ')
  126. c = read();
  127. boolean neg = (c == '-');
  128. if (neg)
  129. c = read();
  130. do {
  131. ret = ret * 10 + c - '0';
  132. }
  133. while ((c = read()) >= '0' && c <= '9');
  134. if (neg)
  135. return -ret;
  136. return ret;
  137. }
  138.  
  139. public double nextDouble() throws IOException
  140. {
  141. double ret = 0, div = 1;
  142. byte c = read();
  143. while (c <= ' ')
  144. c = read();
  145. boolean neg = (c == '-');
  146. if (neg)
  147. c = read();
  148.  
  149. do {
  150. ret = ret * 10 + c - '0';
  151. }
  152. while ((c = read()) >= '0' && c <= '9');
  153.  
  154. if (c == '.')
  155. {
  156. while ((c = read()) >= '0' && c <= '9')
  157. {
  158. ret += (c - '0') / (div *= 10);
  159. }
  160. }
  161.  
  162. if (neg)
  163. return -ret;
  164. return ret;
  165. }
  166.  
  167. private void fillBuffer() throws IOException
  168. {
  169. bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
  170. if (bytesRead == -1)
  171. buffer[0] = -1;
  172. }
  173.  
  174. private byte read() throws IOException
  175. {
  176. if (bufferPointer == bytesRead)
  177. fillBuffer();
  178. return buffer[bufferPointer++];
  179. }
  180.  
  181. public void close() throws IOException
  182. {
  183. if (din == null)
  184. return;
  185. din.close();
  186. }
  187. }
Success #stdin #stdout 0.18s 57604KB
stdin
3
28
qaabzwsxedcrfvtgbyhnujmiklop
13
cleanairactbd
10
aannttoonn
stdout
ac
f
b