codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

298A.md (1904B)


      1 Source: https://codeforces.com/problemset/problem/298/A
      2 
      3 A. Snow Footprints
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 There is a straight snowy road, divided into *n* blocks. The blocks are numbered from 1 to *n* from left to right. If one moves from the *i*-th block to the (*i* + 1)-th block, he will leave a right footprint on the *i*-th block. Similarly, if one moves from the *i*-th block to the (*i* - 1)-th block, he will leave a left footprint on the *i*-th block. If there already is a footprint on the *i*-th block, the new footprint will cover the old one.
     22 
     23  ![](https://espresso.codeforces.com/f41948ee78d5cb0b88a36325cd910242c3e7bcbe.png) 
     24 
     25 At the beginning, there were no footprints. Then polar bear Alice starts from the *s*-th block, makes a sequence of moves and ends in the *t*-th block. It is known that Alice never moves outside of the road.
     26 
     27 You are given the description of Alice's footprints. Your task is to find a pair of possible values of *s*, *t* by looking at the footprints.
     28 
     29 Input
     30 
     31 The first line of the input contains integer *n* (3 ≤ *n* ≤ 1000).
     32 
     33 The second line contains the description of the road — the string that consists of *n* characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint).
     34 
     35 It's guaranteed that the given string contains at least one character not equal to ".". Also, the first and the last character will always be ".". It's guaranteed that a solution exists.
     36 
     37 Output
     38 
     39 Print two space-separated integers — the values of *s* and *t*. If there are several possible solutions you can print any of them.
     40 
     41 Examples
     42 
     43 Input
     44 
     45 ```
     46 9  
     47 ..RRLL...
     48 ```
     49 
     50 Output
     51 
     52 ```
     53 3 4
     54 ```
     55 
     56 Input
     57 
     58 ```
     59 11  
     60 .RRRLLLLL..
     61 ```
     62 
     63 Output
     64 
     65 ```
     66 7 5
     67 ```
     68 
     69 Note
     70 
     71 The first test sample is the one in the picture.