Submission #15736928
Source Code Expand
Copy
use proconio::input; use proconio::marker::Chars; fn main() { input! { s: Chars, }; let mut ans = 100; for i in 0..26 { let c = (i as u8 + 'a' as u8) as char; let (l, r) = { let mut max_l = 0; let mut l = 0; for &s_i in s.iter() { if s_i == c { max_l = std::cmp::max(max_l, l); l = 0; } else { l += 1; } } (max_l, l) }; let v = r + std::cmp::max(0, l - r); ans = std::cmp::min(ans, v); } println!("{}", ans); }
Submission Info
Submission Time | |
---|---|
Task | A - Shrinking |
User | bouzuya |
Language | Rust (1.42.0) |
Score | 300 |
Code Size | 652 Byte |
Status | AC |
Exec Time | 7 ms |
Memory | 2156 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 7 ms | 1976 KB |
0_01.txt | AC | 1 ms | 2112 KB |
0_02.txt | AC | 2 ms | 1960 KB |
0_03.txt | AC | 1 ms | 2028 KB |
1_00.txt | AC | 1 ms | 1980 KB |
1_01.txt | AC | 2 ms | 1992 KB |
1_02.txt | AC | 2 ms | 2100 KB |
1_03.txt | AC | 1 ms | 2016 KB |
1_04.txt | AC | 2 ms | 2076 KB |
1_05.txt | AC | 2 ms | 2024 KB |
1_06.txt | AC | 2 ms | 1956 KB |
1_07.txt | AC | 1 ms | 1896 KB |
1_08.txt | AC | 2 ms | 2156 KB |
1_09.txt | AC | 1 ms | 2120 KB |