Problem:
Score : 100 points

Problem Statement

We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.

Find the maximum number of consecutive rainy days in this period.

Constraints

|S| = 3

Each character of S is S or R.

Input

Input is given from Standard Input in the following format:

S

Output

Print the maximum number of consecutive rainy days in the period.

Sample Input 1

RRS

Sample Output 1

2

We had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.

Sample Input 2

SSS

Sample Output 2

0

It was sunny throughout the period. We had no rainy days, so we should print 0.

Sample Input 3

RSR

Sample Output 3

1

We had rain on the 1-st and 3-rd days - two "streaks" of one rainy day, so we should print 1.

Solution in Rust (1.42.0) (judge verdict: Accepted)

//! # Bundled libraries
//!
//! ## [`lib`](https://github.com/qryxip/oj-verify-playground)
//!
//! ### Modules
//!
//! - `::lib::input` → `$crate::input`

/*#[cfg_attr(cargo_equip, cargo_equip::equip)]
use ::lib::input;*/
#[allow(unused_imports)]
use std::string;
fn main() {
    input! {
        s:String
    }
    if s.contains("R") {
        if s.contains("RR") {
            if s.contains("RRR") {
                println!("3");
            } else {
                println!("2");
            }
        } else {
            println!("1");
        }
    } else {
        println!("0");
    }
}

// The following code was expanded by `cargo-equip`.

#[allow(clippy::deprecated_cfg_attr)] #[cfg_attr(rustfmt, rustfmt::skip)] pub mod input { use std :: { cell :: RefCell , fmt :: Debug , io :: { self , BufRead , Read } , rc :: Rc , str :: { FromStr , SplitWhitespace } , } ; # [macro_export] macro_rules ! input { (from $ scanner : ident ; $ ($ tt : tt) *) => { $ crate :: input_inner ! (@ scanner ($ scanner) , @ tts ($ ($ tt) *)) } ; ($ ($ tt : tt) *) => { let __scanner = $ crate :: input :: DEFAULT_SCANNER . with (| __scanner | __scanner . clone ()) ; let mut __scanner_ref = __scanner . borrow_mut () ; if let $ crate :: input :: Scanner :: Uninited = * __scanner_ref { * __scanner_ref = $ crate :: input :: Scanner :: stdin_auto () . unwrap () ; } $ crate :: input_inner ! (@ scanner (__scanner_ref) , @ tts ($ ($ tt) *)) ; :: std :: mem :: drop (__scanner_ref) ; :: std :: mem :: drop (__scanner) ; } ; } # [macro_export] macro_rules ! input_inner { (@ scanner ($ scanner : ident) , @ tts ()) => { } ; (@ scanner ($ scanner : ident) , @ tts (mut $ single_tt_pat : tt : $ readable : tt)) => { let mut $ single_tt_pat = $ crate :: read ! (from $ scanner { $ readable }) ; } ; (@ scanner ($ scanner : ident) , @ tts ($ single_tt_pat : tt : $ readable : tt)) => { let $ single_tt_pat = $ crate :: read ! (from $ scanner { $ readable }) ; } ; (@ scanner ($ scanner : ident) , @ tts (mut $ single_tt_pat : tt : $ readable : tt , $ ($ rest : tt) *)) => { $ crate :: input_inner ! (@ scanner ($ scanner) , @ tts (mut $ single_tt_pat : $ readable)) ; $ crate :: input_inner ! (@ scanner ($ scanner) , @ tts ($ ($ rest) *)) ; } ; (@ scanner ($ scanner : ident) , @ tts ($ single_tt_pat : tt : $ readable : tt , $ ($ rest : tt) *)) => { $ crate :: input_inner ! (@ scanner ($ scanner) , @ tts ($ single_tt_pat : $ readable)) ; $ crate :: input_inner ! (@ scanner ($ scanner) , @ tts ($ ($ rest) *)) ; } ; } # [macro_export] macro_rules ! read { (from $ scanner : ident { [$ tt : tt] }) => { $ crate :: read ! (from $ scanner { [$ tt ; $ crate :: read ! (from $ scanner { usize })] }) } ; (from $ scanner : ident { [$ tt : tt ; $ n : expr] }) => { (0 ..$ n) . map (| _ | $ crate :: read ! (from $ scanner { $ tt })) . collect ::< Vec < _ >> () } ; (from $ scanner : ident { ($ ($ tt : tt) ,+) }) => { ($ ($ crate :: read ! (from $ scanner { $ tt })) ,*) } ; (from $ scanner : ident { $ ty : ty }) => { <$ ty as $ crate :: input :: Readable >:: read_from_scanner (& mut $ scanner) } ; } # [macro_export] macro_rules ! readable { ($ name : ident ; |$ scanner : ident | { $ ($ body : tt) * }) => { $ crate :: readable ! ($ name ; |$ scanner | -> () { $ ($ body) * }) ; } ; ($ name : ident ; |$ scanner : ident | $ expr : expr) => { $ crate :: readable ! ($ name ; |$ scanner | -> () { $ expr }) ; } ; ($ name : ident ; |$ scanner : ident | -> $ output : ty { $ ($ body : tt) * }) => { enum $ name { } impl $ crate :: input :: Readable for $ name { type Output = $ output ; fn read_from_scanner (mut $ scanner : & mut $ crate :: input :: Scanner) -> $ output { $ ($ body) * } } } ; } pub enum Scanner { Uninited , Once { words : SplitWhitespace <'static >, } , Lines { rdr : Box < dyn BufRead >, words : SplitWhitespace <'static >, } , } impl Scanner { pub fn stdin_auto () -> io :: Result < Self > { if cfg ! (debug_assertions) { Ok (Self :: lines (Box :: leak (Box :: new (io :: stdin ())) . lock ())) } else { Self :: once (io :: stdin ()) } } pub fn once < R : Read > (mut rdr : R) -> io :: Result < Self > { let mut buf = String :: with_capacity (1024) ; rdr . read_to_string (& mut buf) ?; let words = Box :: leak (buf . into_boxed_str ()) . split_whitespace () ; Ok (Self :: Once { words }) } pub fn lines < R : BufRead + 'static > (rdr : R) -> Self { Self :: Lines { rdr : Box :: new (rdr) , words : "" . split_whitespace () , } } pub fn parse_next_unwrap < T : FromStr > (& mut self) -> T where T :: Err : Debug , { match self { Self :: Uninited => None , Self :: Once { words } => words . next () , Self :: Lines { rdr , words } => words . next () . or_else (|| { let mut line = "" . to_owned () ; rdr . read_line (& mut line) . unwrap () ; * words = Box :: leak (line . into_boxed_str ()) . split_whitespace () ; words . next () }) , } . expect ("reached EOF") . parse () . unwrap () } } thread_local ! { pub static DEFAULT_SCANNER : Rc < RefCell < Scanner >> = Rc :: new (RefCell :: new (Scanner :: Uninited)) ; } pub trait Readable { type Output ; fn read_from_scanner (scanner : & mut Scanner) -> Self :: Output ; } impl < T : FromStr > Readable for T where T :: Err : Debug , { type Output = Self ; fn read_from_scanner (scanner : & mut Scanner) -> Self { scanner . parse_next_unwrap () } } }