Submission #345269
Source Code Expand
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String line = scanner.nextLine(); char preChar = ' '; int counter = 0; StringBuffer zipBuffer = new StringBuffer(); for (char c : line.toCharArray()) { if (counter == 0) { preChar = c; counter++; continue; } if (c == preChar) { counter++; continue; } zipBuffer.append(preChar); zipBuffer.append(counter); counter = 1; preChar = c; } zipBuffer.append(preChar); zipBuffer.append(counter); System.out.println(zipBuffer.toString()); scanner.close(); } }
Submission Info
Submission Time | |
---|---|
Task | B - 高橋くんと文字列圧縮 |
User | diabetic |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 764 Byte |
Status | AC |
Exec Time | 587 ms |
Memory | 23304 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 | 468 ms | 23292 KB |
1.txt | AC | 395 ms | 23244 KB |
10.txt | AC | 395 ms | 23204 KB |
11.txt | AC | 411 ms | 23136 KB |
12.txt | AC | 409 ms | 23248 KB |
13.txt | AC | 400 ms | 23180 KB |
14.txt | AC | 398 ms | 23212 KB |
15.txt | AC | 587 ms | 23276 KB |
16.txt | AC | 408 ms | 23216 KB |
17.txt | AC | 431 ms | 23260 KB |
18.txt | AC | 416 ms | 23096 KB |
19.txt | AC | 404 ms | 23204 KB |
2.txt | AC | 409 ms | 23204 KB |
20.txt | AC | 408 ms | 23132 KB |
21.txt | AC | 400 ms | 23100 KB |
22.txt | AC | 397 ms | 23192 KB |
23.txt | AC | 399 ms | 23236 KB |
24.txt | AC | 399 ms | 23232 KB |
25.txt | AC | 403 ms | 23196 KB |
26.txt | AC | 393 ms | 23096 KB |
27.txt | AC | 396 ms | 23236 KB |
28.txt | AC | 397 ms | 23264 KB |
29.txt | AC | 404 ms | 23172 KB |
3.txt | AC | 403 ms | 23276 KB |
4.txt | AC | 403 ms | 23140 KB |
5.txt | AC | 405 ms | 23096 KB |
6.txt | AC | 408 ms | 23304 KB |
7.txt | AC | 413 ms | 23144 KB |
8.txt | AC | 407 ms | 23252 KB |
9.txt | AC | 397 ms | 23204 KB |
subtask0_1.txt | AC | 397 ms | 23204 KB |
subtask0_2.txt | AC | 398 ms | 23208 KB |
subtask0_3.txt | AC | 398 ms | 23104 KB |