Created
January 12, 2026 19:58
-
-
Save icub3d/a83370bd58f009ff8fb2d25235074e06 to your computer and use it in GitHub Desktop.
Kattis sevenwonders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::io::{Read, stdin}; | |
| fn main() { | |
| let mut s = String::new(); | |
| stdin().read_to_string(&mut s).unwrap(); | |
| let mut counts = [0; 3]; | |
| for c in s.trim().chars() { | |
| match c { | |
| 'T' => counts[0] += 1, | |
| 'C' => counts[1] += 1, | |
| _ => counts[2] += 1, | |
| } | |
| } | |
| let mut total = counts.iter().map(|&x| x * x).sum::<usize>(); | |
| total += counts.iter().min().unwrap() * 7; | |
| println!("{total}"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment