use std::io;

fn read_line() -> String {
    let mut input_line = String::new();
    io::stdin().read_line(&mut input_line).unwrap();
    return String::from(input_line.trim());
}

fn read_line_vec() -> Vec<u64> {
    return read_line().split(' ')
        .map(|s| s.parse().unwrap())
        .collect();
}

fn read_line_pair() -> (u64, u64) {
    let vec = read_line_vec();
    return (vec[0], vec[1]);
}

fn get_bp(n: u64, m: u64) -> u64 {
    if n == 1 {
        return 1;
    }
    assert!(m > 0);
    let left = m - 1;
    let right = n - m;

    if left == right {
        return left;
    }
    if left < right {
        return m + 1;
    }
    return left;
}

fn main() {
    let (n, m) = read_line_pair();
    let res = get_bp(n, m);

    println!("{}", res);
}

//spnauti-rusT
use std::io::*;
use std::str::{self,*};
use std::fmt::Debug;
#[allow(unused_imports)] use std::cmp::Ordering::{self,*};
#[allow(unused_imports)] use std::ops::{self,*};
#[allow(unused_imports)] use std::iter::{self,*};
#[allow(unused_imports)] use std::collections::*;
#[allow(unused_macros)]
macro_rules! m {
    ($c:tt, $x:expr, $y:expr) => {{
        let b = $y; let a = &mut $x;
        if b $c *a { *a = b; true } else { false }
    }};
}
#[allow(unused_macros)]
macro_rules! l {
    ($($v:ident),* = $i:ident.$f:ident $a:tt) => {
        $( let $v = $i.$f$a; )*
    };
    ($($v:ident),*:$t:ty = $i:ident.$f:ident $a:tt) => {
        $( let $v:$t = $i.$f$a; )*
    };
}
struct WordReader<'a> { it : SplitAsciiWhitespace<'a> }
#[allow(dead_code)]
impl<'a> WordReader<'a> {
    fn new<T: Read>(b: &mut String, mut r: T) -> WordReader {
        b.clear();
        r.read_to_string(b).ok();
        WordReader { it: b.split_ascii_whitespace() }
    }
    fn from_stdin(b: &mut String) -> WordReader {
        WordReader::new(b, stdin())
    }
    fn sl(&mut self) ->  &str { self.it.next().unwrap() }
    fn bs(&mut self) -> &[u8] { self.sl().as_bytes()    }
    fn s(&mut self) -> String { String::from(self.sl()) }
    fn i(&mut self) ->    i32 { self.p()                }
    fn f(&mut self) ->    f64 { self.p()                }
    fn u(&mut self) ->  usize { self.p()                }
    fn sk(&mut self, n: usize) { self.it.nth(n - 1); }
    fn ii(&mut self, n: usize) -> impl Iterator<Item=i32> {
        self.ip(n).into_iter()
    }
    fn vi(&mut self, n: usize) -> Vec<i32> {
        self.vp::<i32>(n)
    }
    fn p<T: FromStr>(&mut self) -> T where T::Err: Debug {
        self.sl().parse::<T>().unwrap()
    }
    fn ip<T: FromStr>(&mut self, n: usize) -> impl Iterator<Item=T> where T::Err: Debug {
        self.vp(n).into_iter()
    }
    fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
        (0..n).map(|_| self.p()).collect()
    }
}
//------------------- End rusT

fn main() {
    let mut bin = String::new();
    let mut input = WordReader::from_stdin(&mut bin);

    l!(n,m = input.i());
    let sol = if n == 1 {
        1
    } else if m - 1 >= n - m {
        m - 1
    } else {
        m + 1
    };
    println!("{}", sol);
}

#![allow(unused_imports)]
#![allow(unused_macros)]
// use proconio::input;
use std::cmp::{Ordering::*, Reverse};
use std::collections::{BTreeMap, BTreeSet};
use std::io::{self, BufWriter, Write};
use std::str::{self, SplitAsciiWhitespace};

// I have no idea what I'm doing

macro_rules! answer {
    ($out:ident, $ans:expr) => {
        writeln!($out, "{}", $ans)
    };
}

fn main() -> Result<(), io::Error> {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = UnsafeScanner::new(stdin.lock());
    let mut out = BufWriter::new(stdout.lock());

    let (n, m) = scan.pair::<i32>();

    if n == 1 {
        return answer!(out, 1);
    }

    answer!(out, if m-1 < n-m {
        m+1
    } else {
        m-1
    })
}

///////////////////////////////////////////////////////////////////////////////////////////////////

/// Mostly copied from https://github.com/EbTech/rust-algorithms/blob/master/src/scanner.rs
/// Same API as Scanner but nearly twice as fast, using horribly unsafe dark arts
/// **REQUIRES** Rust 1.34 or higher
pub struct UnsafeScanner<R> {
    reader: R,
    buf_str: Vec<u8>,
    buf_iter: SplitAsciiWhitespace<'static>,
}

impl<R: io::BufRead> UnsafeScanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buf_str: vec![],
            buf_iter: "".split_ascii_whitespace(),
        }
    }

    /// This function should be marked unsafe, but noone has time for that in a
    /// programming contest. Use at your own risk!
    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buf_iter.next() {
                return token.parse().ok().expect("Failed parse [Scanner]");
            }
            self.buf_str.clear();
            self.reader
                .read_until(b'\n', &mut self.buf_str)
                .expect("Failed read");
            self.buf_iter = unsafe {
                let slice = str::from_utf8_unchecked(&self.buf_str);
                std::mem::transmute(slice.split_ascii_whitespace())
            }
        }
    }

    pub fn pair<T: str::FromStr>(&mut self) -> (T, T) {
        (self.token(), self.token())
    }
}

// aka #![feature(bool_to_option)]
trait BoolThen {
    fn then_<T>(self, f: impl FnOnce() -> T) -> Option<T>;
}

impl BoolThen for bool {
    fn then_<T>(self, f: impl FnOnce() -> T) -> Option<T> {
        if self {
            Some(f())
        } else {
            None
        }
    }
}

trait BoolToYes {
    fn yes(self) -> &'static str;
}

impl BoolToYes for bool {
    fn yes(self) -> &'static str {
        match self {
            true => "YES",
            false => "NO",
        }
    }
}

#![allow(unused_imports)]
#![allow(unused_macros)]
// use proconio::input;
use std::cmp::{Ordering::*, Reverse};
use std::collections::{BTreeMap, BTreeSet};
use std::io::{self, BufWriter, Write};
use std::str::{self, SplitAsciiWhitespace};

// I have no idea what I'm doing

macro_rules! answer {
    ($out:ident, $ans:expr) => {
        writeln!($out, "{}", $ans)
    };
}

fn main() -> Result<(), io::Error> {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = UnsafeScanner::new(stdin.lock());
    let mut out = BufWriter::new(stdout.lock());

    let (n, m) = scan.pair::<i32>();

    answer!(out, if m-1 <= n-m {
        m+1
    } else {
        m-1
    })
}

///////////////////////////////////////////////////////////////////////////////////////////////////

/// Mostly copied from https://github.com/EbTech/rust-algorithms/blob/master/src/scanner.rs
/// Same API as Scanner but nearly twice as fast, using horribly unsafe dark arts
/// **REQUIRES** Rust 1.34 or higher
pub struct UnsafeScanner<R> {
    reader: R,
    buf_str: Vec<u8>,
    buf_iter: SplitAsciiWhitespace<'static>,
}

impl<R: io::BufRead> UnsafeScanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buf_str: vec![],
            buf_iter: "".split_ascii_whitespace(),
        }
    }

    /// This function should be marked unsafe, but noone has time for that in a
    /// programming contest. Use at your own risk!
    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buf_iter.next() {
                return token.parse().ok().expect("Failed parse [Scanner]");
            }
            self.buf_str.clear();
            self.reader
                .read_until(b'\n', &mut self.buf_str)
                .expect("Failed read");
            self.buf_iter = unsafe {
                let slice = str::from_utf8_unchecked(&self.buf_str);
                std::mem::transmute(slice.split_ascii_whitespace())
            }
        }
    }

    pub fn pair<T: str::FromStr>(&mut self) -> (T, T) {
        (self.token(), self.token())
    }
}

// aka #![feature(bool_to_option)]
trait BoolThen {
    fn then_<T>(self, f: impl FnOnce() -> T) -> Option<T>;
}

impl BoolThen for bool {
    fn then_<T>(self, f: impl FnOnce() -> T) -> Option<T> {
        if self {
            Some(f())
        } else {
            None
        }
    }
}

trait BoolToYes {
    fn yes(self) -> &'static str;
}

impl BoolToYes for bool {
    fn yes(self) -> &'static str {
        match self {
            true => "YES",
            false => "NO",
        }
    }
}

#![allow(unused_imports)]
#![allow(unused_macros)]
// use proconio::input;
use std::cmp::{Ordering::*, Reverse};
use std::collections::{BTreeMap, BTreeSet};
use std::io::{self, BufWriter, Write};
use std::str::{self, SplitAsciiWhitespace};

// I have no idea what I'm doing

macro_rules! answer {
    ($out:ident, $ans:expr) => {
        writeln!($out, "{}", $ans)
    };
}

fn main() -> Result<(), io::Error> {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = UnsafeScanner::new(stdin.lock());
    let mut out = BufWriter::new(stdout.lock());

    let (n, m) = scan.pair::<i32>();

    if n == 1 {
        return answer!(out, 1);
    }

    answer!(out, if m-1 <= n-m {
        m+1
    } else {
        m-1
    })
}

///////////////////////////////////////////////////////////////////////////////////////////////////

/// Mostly copied from https://github.com/EbTech/rust-algorithms/blob/master/src/scanner.rs
/// Same API as Scanner but nearly twice as fast, using horribly unsafe dark arts
/// **REQUIRES** Rust 1.34 or higher
pub struct UnsafeScanner<R> {
    reader: R,
    buf_str: Vec<u8>,
    buf_iter: SplitAsciiWhitespace<'static>,
}

impl<R: io::BufRead> UnsafeScanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buf_str: vec![],
            buf_iter: "".split_ascii_whitespace(),
        }
    }

    /// This function should be marked unsafe, but noone has time for that in a
    /// programming contest. Use at your own risk!
    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buf_iter.next() {
                return token.parse().ok().expect("Failed parse [Scanner]");
            }
            self.buf_str.clear();
            self.reader
                .read_until(b'\n', &mut self.buf_str)
                .expect("Failed read");
            self.buf_iter = unsafe {
                let slice = str::from_utf8_unchecked(&self.buf_str);
                std::mem::transmute(slice.split_ascii_whitespace())
            }
        }
    }

    pub fn pair<T: str::FromStr>(&mut self) -> (T, T) {
        (self.token(), self.token())
    }
}

// aka #![feature(bool_to_option)]
trait BoolThen {
    fn then_<T>(self, f: impl FnOnce() -> T) -> Option<T>;
}

impl BoolThen for bool {
    fn then_<T>(self, f: impl FnOnce() -> T) -> Option<T> {
        if self {
            Some(f())
        } else {
            None
        }
    }
}

trait BoolToYes {
    fn yes(self) -> &'static str;
}

impl BoolToYes for bool {
    fn yes(self) -> &'static str {
        match self {
            true => "YES",
            false => "NO",
        }
    }
}

//spnauti-rusT
use std::io::*;
use std::str::{self,*};
use std::fmt::Debug;
#[allow(unused_imports)] use std::cmp::Ordering::{self,*};
#[allow(unused_imports)] use std::ops::{self,*};
#[allow(unused_imports)] use std::iter::{self,*};
#[allow(unused_imports)] use std::collections::*;
#[allow(unused_macros)]
macro_rules! m {
    ($c:tt, $x:expr, $y:expr) => {{
        let b = $y; let a = &mut $x;
        if b $c *a { *a = b; true } else { false }
    }};
}
#[allow(unused_macros)]
macro_rules! l {
    ($($v:ident),* = $i:ident.$f:ident $a:tt) => {
        $( let $v = $i.$f$a; )*
    };
    ($($v:ident),*:$t:ty = $i:ident.$f:ident $a:tt) => {
        $( let $v:$t = $i.$f$a; )*
    };
}
struct WordReader<'a> { it : SplitAsciiWhitespace<'a> }
#[allow(dead_code)]
impl<'a> WordReader<'a> {
    fn new<T: Read>(b: &mut String, mut r: T) -> WordReader {
        b.clear();
        r.read_to_string(b).ok();
        WordReader { it: b.split_ascii_whitespace() }
    }
    fn from_stdin(b: &mut String) -> WordReader {
        WordReader::new(b, stdin())
    }
    fn sl(&mut self) ->  &str { self.it.next().unwrap() }
    fn bs(&mut self) -> &[u8] { self.sl().as_bytes()    }
    fn s(&mut self) -> String { String::from(self.sl()) }
    fn i(&mut self) ->    i32 { self.p()                }
    fn f(&mut self) ->    f64 { self.p()                }
    fn u(&mut self) ->  usize { self.p()                }
    fn sk(&mut self, n: usize) { self.it.nth(n - 1); }
    fn ii(&mut self, n: usize) -> impl Iterator<Item=i32> {
        self.ip(n).into_iter()
    }
    fn vi(&mut self, n: usize) -> Vec<i32> {
        self.vp::<i32>(n)
    }
    fn p<T: FromStr>(&mut self) -> T where T::Err: Debug {
        self.sl().parse::<T>().unwrap()
    }
    fn ip<T: FromStr>(&mut self, n: usize) -> impl Iterator<Item=T> where T::Err: Debug {
        self.vp(n).into_iter()
    }
    fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
        (0..n).map(|_| self.p()).collect()
    }
}
//------------------- End rusT

fn main() {
    let mut bin = String::new();
    let mut input = WordReader::from_stdin(&mut bin);

    l!(n,m = input.i());
    let sol = if m - 1 >= n - m {
        m - 1
    } else {
        m + 1
    };
    println!("{}", sol);
}

use std::io;

fn read_line() -> String {
    let mut input_line = String::new();
    io::stdin().read_line(&mut input_line).unwrap();
    return String::from(input_line.trim());
}

fn read_line_vec() -> Vec<u64> {
    return read_line().split(' ')
        .map(|s| s.parse().unwrap())
        .collect();
}

fn read_line_pair() -> (u64, u64) {
    let vec = read_line_vec();
    return (vec[0], vec[1]);
}

fn get_bp(n: u64, m: u64) -> u64 {
    assert!(m > 0);
    let left = m - 1;
    let right = n - m;
    if left == right {
        return m;
    }
    if left < right {
        return m + 1;
    }
    return left;
}

fn main() {
    let (n, m) = read_line_pair();
    let res = get_bp(n, m);

    println!("{}", res);
}


use std::io::{self, BufWriter, Write};
use std::str::{self, SplitAsciiWhitespace};

/// Copied from https://github.com/EbTech/rust-algorithms/blob/master/src/scanner.rs
/// Same API as Scanner but nearly twice as fast, using horribly unsafe dark arts
/// **REQUIRES** Rust 1.34 or higher
pub struct UnsafeScanner<R> {
    reader: R,
    buf_str: Vec<u8>,
    buf_iter: SplitAsciiWhitespace<'static>,
}

impl<R: io::BufRead> UnsafeScanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buf_str: vec![],
            buf_iter: "".split_ascii_whitespace(),
        }
    }

    /// This function should be marked unsafe, but noone has time for that in a
    /// programming contest. Use at your own risk!
    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buf_iter.next() {
                return token.parse().ok().expect("Failed parse");
            }
            self.buf_str.clear();
            self.reader
                .read_until(b'\n', &mut self.buf_str)
                .expect("Failed read");
            self.buf_iter = unsafe {
                let slice = str::from_utf8_unchecked(&self.buf_str);
                std::mem::transmute(slice.split_ascii_whitespace())
            }
        }
    }

    pub fn pair<T: str::FromStr>(&mut self) -> (T, T) {
        (self.token(), self.token())
    }
}

fn main() -> Result<(), io::Error> {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = UnsafeScanner::new(stdin.lock());
    let mut out = BufWriter::new(stdout.lock());

    let n: i32 = scan.token();

    let mut pten: i32 = 1;
    let mut m = n;
    while m > 9 {
        m /= 10;
        pten *= 10;
    }

    m += 1;
    m *= pten;

    writeln!(out, "{}", m - n)?;

    Ok(())
}

use std::io;

fn main(){
    let mut inp = String::new();
    io::stdin().read_line(&mut inp).expect("Error while taking input");
    let num: u32 = inp.trim().parse().expect("Number can't be parsed");
    let ipsize: u32 = inp.trim().len() as u32;
    let magicnum = 10u32.pow(ipsize - 1);
    let nlucky = (num/magicnum + 1) * magicnum;
    println!("{}", nlucky-num);
}


//! http://codeforces.com/contest/208/problem/A

#[macro_export]
macro_rules! scanln {
  ($($var:ident : $ty:path),+) => {
    $(let $var: $ty;)+
    {
      use std::io;
      let mut __buf = String::new();
      io::stdin().read_line(&mut __buf).unwrap();
      let mut eles = __buf.split_whitespace();
      $($var = Scan::scan(&mut eles);)+
    }
  }
}

pub trait Scan {
  fn scan<'a, I>(eles: &mut I) -> Self where I: Iterator<Item=&'a str>;
}

macro_rules! impl_scan_single {
  ($ty:ty) => {
    impl Scan for $ty {
      fn scan<'a, I>(eles: &mut I) -> Self where I: Iterator<Item=&'a str> {
        let next = eles.next().unwrap();
        match next.parse() {
          Ok(res) => res,
          Err(_) => panic!()
        }
      }
    }
  }
}

impl_scan_single!(u8);
impl_scan_single!(u16);
impl_scan_single!(u32);
impl_scan_single!(u64);
impl_scan_single!(usize);
impl_scan_single!(i8);
impl_scan_single!(i16);
impl_scan_single!(i32);
impl_scan_single!(i64);
impl_scan_single!(isize);
impl_scan_single!(String);

const __IMPL_SCAN_FOR_VEC: () = {
  use std::str::FromStr;
  impl<T> Scan for Vec<T> where T: FromStr {
    fn scan<'a, I>(eles: &mut I) -> Self where I: Iterator<Item=&'a str> {
      eles.map(|str| match str.parse() {
        Ok(res) => res,
        Err(_) => panic!()
      }).collect()
    }
  }
};

// -----------------------------------------------------------------------------

fn main() {
  scanln!(wubs: String);
  let words = wubs.split("WUB");
  let mut result: Vec<String> = Vec::new();
  for word in words {
    if !word.is_empty() { result.push(word.into()); }
  }
  for (i, word) in result.into_iter().enumerate() {
    if i != 0 { print!(" "); }
    print!("{}", word);
  }
  println!("");
}

#[allow(unused)] use std::io::*;
#[allow(unused)] use std::collections::*;
#[allow(unused)] use std::mem::*;
#[allow(unused)] use std::num::*;
#[allow(unused)] use std::cmp::*;
#[allow(unused)] macro_rules! scan { ($($x:ty), +) => {{
    let mut inp = String::new(); stdin().read_line(&mut inp).ok();
    let s = inp.split(' ').map(|x| x.trim()).filter(|x| x.len() != 0).collect();
    let mut cnt : usize = 0;
    fn next<T>(cnt: &mut usize, p: &Vec<&str>) -> T where T:std::str::FromStr
    { *cnt += 1; p[*cnt-1].parse().ok().unwrap() }
    ($(next::<$x>(&mut cnt, &s)), +)
    }}; }
#[allow(unused)] macro_rules! arr { ($n:expr, $T:ty) => {{
    let mut inp = String::new(); stdin().read_line(&mut inp).ok();
    let mut s = inp.split(' ').map(|x| x.trim()).filter(|x| x.len() != 0);
    let mut v = Vec::new(); v.reserve(($n) as usize);
    for st in s { v.push(st.parse::<$T>().unwrap()); } v
    }}; }

///////////////////////////////////////////////////////////////////////////////
fn main()
{
    let s = scan!(String);
    s.split("WUB").filter(|x| x.len() != 0).map(|x| x.to_owned() + " ").map(|x| print!("{}", x)).for_each(drop);
}

#[allow(unused)] use std::io::*;
#[allow(unused)] use std::collections::*;
#[allow(unused)] use std::mem::*;
#[allow(unused)] use std::num::*;
#[allow(unused)] use std::cmp::*;
#[allow(unused)] macro_rules! scan { ($($x:ty), +) => {{
    let mut inp = String::new(); stdin().read_line(&mut inp).ok();
    let s = inp.split(' ').map(|x| x.trim()).filter(|x| x.len() != 0).collect();
    let mut cnt : usize = 0;
    fn next<T>(cnt: &mut usize, p: &Vec<&str>) -> T where T:std::str::FromStr
    { *cnt += 1; p[*cnt-1].parse().ok().unwrap() }
    ($(next::<$x>(&mut cnt, &s)), +)
    }}; }
#[allow(unused)] macro_rules! arr { ($n:expr, $T:ty) => {{
    let mut inp = String::new(); stdin().read_line(&mut inp).ok();
    let mut s = inp.split(' ').map(|x| x.trim()).filter(|x| x.len() != 0);
    let mut v = Vec::new(); v.reserve(($n) as usize);
    for st in s { v.push(st.parse::<$T>().unwrap()); } v
    }}; }

///////////////////////////////////////////////////////////////////////////////
fn main()
{
    let s = scan!(String);
    s.split("WUB").filter(|x| x.len() != 0).for_each(|x| print!("{} ", x));
}

fn main() {
    let line = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf.trim().to_string()
    };

    println!("{}", line.split("WUB").filter(|&a| a != "").collect::<Vec<&str>>().join(" "));
}

//spnauti-rust
struct WordReader {
    it : std::vec::IntoIter<String>,
}
#[allow(dead_code)]
impl WordReader {
    fn new<T : std::io::Read>(mut reader : T) -> WordReader {
        let mut s = String::new();
        reader.read_to_string(&mut s).unwrap();
        WordReader { it : s
            .split_ascii_whitespace()
            .map(String::from).collect::<Vec<_>>()
            .into_iter()
        }
    }
    fn from_stdin() -> WordReader {
        WordReader::new(std::io::stdin())
    }
    fn s(&mut self) -> String {
        self.it.next().unwrap()
    }
    fn ab(&mut self) -> Vec<u8> {
        self.it.next().unwrap().into_bytes()
    }
    fn i(&mut self) -> i32 {
        self.it.next().unwrap().parse().unwrap()
    }
}

fn main() {
    let mut input = WordReader::from_stdin();
    input.s().replace("WUB", " ").split_whitespace().map(|x| print!("{} ", x)).count();
}

fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line);
    let line = line.trim();

    let words: Vec<&str> = line.split("WUB").collect();

    let ret = words.iter().fold(String::new(),
                                |s, w| if w.len() != 0 { s + w + " " } else { s });
    println!("{}", ret.trim());
}

use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();

    let mut ret = String::new();
    for i in 0..buf.len() {
        if ret.ends_with("WUB") {
            let len = ret.len();
//            ret.replace_range((len - 3)..len, "");
            ret = ret[..len - 3].to_string();
            if ret.ends_with(" ") == false {
                if ret.len() > 0 {
                    ret.push(' ');
                }
            }
        }
        ret.push_str(&buf[i..i + 1]);
    }
    println!("{}", ret.trim());
}

use std::io::{self, BufRead};

fn main() {
    let stdin = io::stdin();
    let mut iterator = stdin.lock().lines();

    let line = iterator.next().unwrap().unwrap();

    let words: Vec<&str> = line
        .split("WUB")
        .filter(|s| !s.is_empty())
        .collect();

    println!("{}", words.join(" "));
}

// {{{ by shik

use std::io;

#[allow(dead_code)]
fn gets() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(unused_macros)]
macro_rules! R {
    ( $ty:ty, ... ) => {
        gets().split_whitespace().map(|x| x.parse::<$ty>().unwrap()).collect::<Vec<_>>()
    };
    ( $($ty:ty),* ) => {{
        let line = gets();
        let mut it = line.split_whitespace();
        ( $(it.next().unwrap().parse::<$ty>().unwrap(),)* )
    }}
}

#[allow(unused_macros)]
macro_rules! W {
    ( $x:expr ) => {{
        println!("{}", $x);
    }};
    ( $x:expr, $($xs:expr),* ) => {{
        print!("{} ", $x);
        W!($($xs),*);
    }}
}

#[allow(unused_macros)]
macro_rules! join {
    ($x:expr, $($xs:expr),*; $sep:expr) => { concat!($x, $($sep, $xs),*) }
}

#[allow(unused_macros)]
macro_rules! dump {
    ($($x:expr),*) => {
        eprintln!(join!($(concat!(stringify!($x), " = {:?}")),*; ", "), $($x),*);
    }
}

// }}}

fn main() {
    println!("{}", gets().replace("WUB", " ").split_whitespace().collect::<Vec<&str>>().join(" "));
}

use std::io::*;

fn read<T: std::str::FromStr>(i: &mut StdinLock) -> T {
    let mut s = String::new();
    i.by_ref().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    // initialize stdin
    let sin = std::io::stdin();
    let mut sin = sin.lock();
    let sin = &mut sin;

    let x: String = read(sin);

    let ans: Vec<String> = x.split("WUB")
        .filter(|x| *x != "")
        .map(|x| x.to_string())
        .collect();

    println!("{}", ans.join(" "));
}

use std::io::*;

fn read<T: std::str::FromStr>(i: &mut StdinLock) -> T {
    let mut s = String::new();
    i.by_ref().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    // initialize stdin
    let sin = std::io::stdin();
    let mut sin = sin.lock();
    let sin = &mut sin;

    let x: String = read(sin);

    let ans: Vec<&str> = x.split("WUB").filter(|x| *x != "").collect();

    println!("{}", ans.join(" "));
}

// https://codeforces.com/problemset/problem/208/A
use std::io;

fn main() {
    let mut song = String::new();

    io::stdin()
        .read_line(&mut song)
        .unwrap();

    let song = song.trim();

    let words: Vec<&str> =
        song
        .split("WUB")
        .filter(|x| x.to_string() != "")
        .collect();

    for word in words {
        print!("{} ", word)
    } println!();
}

use std::io;

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s = s.trim().to_string();
    let n = s.len();
    let mut flag = 1;   // 0,一般，1,开头, 2,中间
    let mut i = 0;
    while i < n {
        if i+2 < n && s[i..i+3] == String::from("WUB") {
            i += 3;
            if flag == 1 {

            } else if flag == 2 {

            } else {    // flag == 0
                flag = 2;
                print!(" ");
            }
        }
        else {
            flag = 0;
            print!("{}", s.as_bytes()[i] as char);
            i += 1;
        }
    }
}

fn read_str() -> String {
    let mut buffer: String = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Error");
    buffer.trim().to_string()
}

fn main() {
    print!("{}", read_str().replace("WUB", " ").trim().replace("  ", " ").replace("  ", " "));
}

fn read_str() -> String {
    let mut buffer: String = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Error");
    buffer.trim().to_string()
}

fn main() {
    print!("{}", read_str().replace("WUB", " "));
}

use std::io;
use std::io::Stdin;

fn read_line(stdin : &Stdin, line : &mut String) {
    match stdin.read_line(line) {
        Ok(_) => return,
        Err(msg) => panic!("Could not read line! Message: {}.", msg),
    }
}

fn print_original_song(s : &String) {
    let t = s.replace("WUB", " ");
    let word_iter = t.split_whitespace();
    let mut first = true;
    for word in word_iter {
        if first {
            print!("{}", word);
            first = false;
        } else {
            print!(" {}", word);
        }
    }
    println!();
}

fn main() {
    let stdin = io::stdin();
    let mut s = String::new();
    read_line(&stdin, &mut s);
    print_original_song(&s);
}

fn main() {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();

    let word = word.trim();
    let len = word.len();
    let mut i: usize = 0;

    while i < len {
        if i as i32 <= len as i32 - 3 &&
            word.as_bytes()[i] == b'W' &&
            word.as_bytes()[i + 1] == b'U' &&
            word.as_bytes()[i + 2] == b'B' {
                print!(" ");
                i += 3; continue;
            }

        print!("{}", word.as_bytes()[i] as char);
        i += 1;
    }
}

#[allow(unused_imports)]
use std::cmp::{min,max};
use std::io::{BufWriter, stdin, stdout, Write};

#[derive(Default)]
struct Scanner {
    buffer: Vec<String>
}
impl Scanner {
    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            stdin().read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn main() {
    let mut scan = Scanner::default();
    let out = &mut BufWriter::new(stdout());

	let s = scan.next::<String>();
    let sw = s.replace("WUB", " ");
    let words = sw.split_whitespace().map(String::from).collect::<Vec<String>>();

    writeln!(out, "{}", words.join(" ")).expect("fail");
}

fn main() {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();

    let word = word.trim();
    let len = word.len();
    let mut i: usize = 0;

    while i < len {
        if i <= len - 3 &&
            word.as_bytes()[i] == b'W' &&
            word.as_bytes()[i + 1] == b'U' &&
            word.as_bytes()[i + 2] == b'B' {
                i += 3;
        }
        else {
            print!("{}", word.as_bytes()[i] as char);
            i += 1;
        }
    }

    println!();
}