Created
January 29, 2026 20:09
-
-
Save icub3d/1e0f8fd0b24180d9a1c4c1a015d97b47 to your computer and use it in GitHub Desktop.
Kattis battlesimulation
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 s = s.trim().as_bytes(); | |
| let mut i = 0; | |
| while i < s.len() { | |
| if i + 2 < s.len() && (s[i] != s[i + 1] && s[i + 1] != s[i + 2] && s[i] != s[i + 2]) { | |
| print!("C"); | |
| i += 3; | |
| } else { | |
| print!( | |
| "{}", | |
| match s[i] { | |
| b'R' => 'S', | |
| b'B' => 'K', | |
| _ => 'H', | |
| } | |
| ); | |
| i += 1; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment