301575: CF298A. Snow Footprints

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Snow Footprints

题意翻译

北极熊Alice在一条覆盖着白雪的直行道路上行走,留下一串小爪印。 这条路分为n个部分,这些部分从左到右编号为 1 到 n 。如果Alice从第 i 个块移动到第(i+1)个块,它将在第 i 个块上留下右爪的爪印。类似地,如果它从第 i 个块移动到第(i-1)个块,它将在第 i 个块上留下左爪的爪印。如果第 i 块上已经有爪印,则新爪印将覆盖旧爪印。 一开始,没有爪印,然后它从第s个部分开始,进行一系列移动并在第t个部分结束,并且Alice从未在路外移动。 您将获得Alice的爪印描述。 你的任务是通过查看足迹找到一对可能的s,ts,t值。![](https://cdn.luogu.org/upload/vjudge_pic/CF298A/67d5fe232964f55b35f1d37315e4e2b333131dd5.png)

题目描述

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. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF298A/67d5fe232964f55b35f1d37315e4e2b333131dd5.png)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. 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.

输入输出格式

输入格式


The first line of the input contains integer $ n $ $ (3<=n<=1000) $ . 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). 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.

输出格式


Print two space-separated integers — the values of $ s $ and $ t $ . If there are several possible solutions you can print any of them.

输入输出样例

输入样例 #1

9
..RRLL...

输出样例 #1

3 4

输入样例 #2

11
.RRRLLLLL..

输出样例 #2

7 5

说明

The first test sample is the one in the picture.

Input

题意翻译

北极熊Alice在一条覆盖着白雪的直行道路上行走,留下一串小爪印。 这条路分为n个部分,这些部分从左到右编号为 1 到 n 。如果Alice从第 i 个块移动到第(i+1)个块,它将在第 i 个块上留下右爪的爪印。类似地,如果它从第 i 个块移动到第(i-1)个块,它将在第 i 个块上留下左爪的爪印。如果第 i 块上已经有爪印,则新爪印将覆盖旧爪印。 一开始,没有爪印,然后它从第s个部分开始,进行一系列移动并在第t个部分结束,并且Alice从未在路外移动。 您将获得Alice的爪印描述。 你的任务是通过查看足迹找到一对可能的s,ts,t值。![](https://cdn.luogu.org/upload/vjudge_pic/CF298A/67d5fe232964f55b35f1d37315e4e2b333131dd5.png)

加入题单

算法标签: