Submission #2412730
Source Code Expand
import java.io.UnsupportedEncodingException; import java.util.*; public class Main { public static void main(String[] args) throws UnsupportedEncodingException { Scanner sc = new Scanner(System.in); String st = sc.next(); int l = st.length(); byte[] st_b = st.getBytes(); Arrays.sort(st_b); int i = 0; boolean isTasai = true; for (i = 0; i < l; i++) { byte b = st_b[i]; for (int n = i + 1; n < l - i; n++) { if (b == st_b[n]) { isTasai = false; break; } } } if (isTasai) { if (l != 26) { byte[] min = new byte[1]; min[0] = (byte) (st_b[0] + (byte) 1); for (i = 1; i < l; i++) { if (min[0] == st_b[i]) { min[0]++; } else { break; } } String stmin = new String(min, "UTF-8"); System.out.println(st + stmin); } else { // xでくぎる。 String[] st_nox = st.split("z"); if (!st_nox[0].equals("")) { int ln = st_nox[0].length(); char min = st_nox[0].charAt(ln - 1); char n_min = (char) (min + (char) 1); System.out.println(st_nox[0].replace(min, n_min)); } else { System.out.println("-1"); } } } else { System.out.println("-1"); } sc.close(); } }
Submission Info
Submission Time | |
---|---|
Task | A - Diverse Word |
User | rina |
Language | Java7 (OpenJDK 1.7.0) |
Score | 0 |
Code Size | 1286 Byte |
Status | WA |
Exec Time | 95 ms |
Memory | 22868 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt, s4.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, s1.txt, s2.txt, s3.txt, s4.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 93 ms | 20436 KB |
02.txt | AC | 94 ms | 22484 KB |
03.txt | AC | 93 ms | 20820 KB |
04.txt | WA | 91 ms | 18900 KB |
05.txt | AC | 93 ms | 20820 KB |
06.txt | AC | 92 ms | 18772 KB |
07.txt | AC | 92 ms | 19028 KB |
08.txt | AC | 94 ms | 22868 KB |
09.txt | AC | 93 ms | 22612 KB |
10.txt | WA | 94 ms | 18900 KB |
11.txt | WA | 92 ms | 20820 KB |
12.txt | WA | 92 ms | 20564 KB |
13.txt | WA | 93 ms | 18772 KB |
14.txt | WA | 93 ms | 22868 KB |
15.txt | WA | 93 ms | 20564 KB |
16.txt | AC | 92 ms | 18900 KB |
17.txt | AC | 92 ms | 18772 KB |
18.txt | WA | 93 ms | 20820 KB |
19.txt | AC | 93 ms | 20820 KB |
s1.txt | AC | 92 ms | 20820 KB |
s2.txt | AC | 95 ms | 18900 KB |
s3.txt | AC | 93 ms | 20820 KB |
s4.txt | AC | 93 ms | 18772 KB |