34 lines
624 B
Rust
34 lines
624 B
Rust
use proconio::input;
|
|
|
|
fn main() {
|
|
input!{
|
|
s: String,
|
|
};
|
|
|
|
let mut result = 0;
|
|
let mut white_segment;
|
|
|
|
let first = s.chars().next().unwrap();
|
|
if first == 'W' {
|
|
white_segment = true;
|
|
} else {
|
|
white_segment = false;
|
|
}
|
|
|
|
for c in s.chars() {
|
|
match c {
|
|
'W' => if !white_segment {
|
|
white_segment = true;
|
|
result += 1;
|
|
},
|
|
'B' => if white_segment {
|
|
result += 1;
|
|
white_segment = false;
|
|
},
|
|
_ => (),
|
|
}
|
|
}
|
|
|
|
println!("{}", result);
|
|
}
|