Submission #345054
Source Code Expand
import static java.util.Arrays.*; import java.util.Scanner; public class Main { static void tr(Object... os) { System.err.println(deepToString(os)); } public static void main(String[] args) { new Main().run(); } Scanner sc = new Scanner(System.in); void run() { char[] s = sc.next().toCharArray(); StringBuilder sb = new StringBuilder(); char c = s[0]; int len = 1; for (int i = 1; i < s.length; i++) { if (s[i] == c) { len++; } else { sb.append(c); sb.append(len); c = s[i]; len = 1; } } sb.append(c); sb.append(len); System.out.println(sb.toString()); } }
Submission Info
Submission Time | |
---|---|
Task | B - 高橋くんと文字列圧縮 |
User | hs484 |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 660 Byte |
Status | AC |
Exec Time | 535 ms |
Memory | 23216 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | subtask0_1.txt, subtask0_2.txt, subtask0_3.txt |
All | 0.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, subtask0_1.txt, subtask0_2.txt, subtask0_3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0.txt | AC | 535 ms | 23208 KB |
1.txt | AC | 488 ms | 23104 KB |
10.txt | AC | 484 ms | 23132 KB |
11.txt | AC | 477 ms | 23148 KB |
12.txt | AC | 477 ms | 23044 KB |
13.txt | AC | 472 ms | 23084 KB |
14.txt | AC | 474 ms | 23080 KB |
15.txt | AC | 482 ms | 23124 KB |
16.txt | AC | 488 ms | 23164 KB |
17.txt | AC | 478 ms | 23152 KB |
18.txt | AC | 480 ms | 23096 KB |
19.txt | AC | 493 ms | 23056 KB |
2.txt | AC | 478 ms | 23068 KB |
20.txt | AC | 477 ms | 23216 KB |
21.txt | AC | 477 ms | 23056 KB |
22.txt | AC | 488 ms | 23088 KB |
23.txt | AC | 503 ms | 23128 KB |
24.txt | AC | 487 ms | 23104 KB |
25.txt | AC | 495 ms | 23148 KB |
26.txt | AC | 507 ms | 23068 KB |
27.txt | AC | 498 ms | 23104 KB |
28.txt | AC | 494 ms | 23120 KB |
29.txt | AC | 493 ms | 23076 KB |
3.txt | AC | 495 ms | 23120 KB |
4.txt | AC | 492 ms | 22956 KB |
5.txt | AC | 481 ms | 23056 KB |
6.txt | AC | 481 ms | 23172 KB |
7.txt | AC | 486 ms | 23100 KB |
8.txt | AC | 475 ms | 23048 KB |
9.txt | AC | 490 ms | 23068 KB |
subtask0_1.txt | AC | 474 ms | 23080 KB |
subtask0_2.txt | AC | 486 ms | 23032 KB |
subtask0_3.txt | AC | 481 ms | 23104 KB |