-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path298A.cpp
36 lines (31 loc) · 800 Bytes
/
298A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include<iostream>
using namespace std;
char s[1000];
int main(){
int x,countr=0,countl=0,startr=0,endr=0,startl=0,flag=0,flag2=0;
cin >> x;
cin >> s;
for(int i=0;s[i]!=NULL;i++)
{
//-----------------------------------------------------------------------------------------------------
if(s[i]=='R')
countr++;
else if(s[i]=='L')
countl++;
//-----------------------------------------------------------------------------------------------------
if(flag==0&&s[i]=='R')
{
startr=i;
flag=1;
}
//---------------------------------------------------------------------------------------------------------
if(flag2==0&&s[i]=='L')
{
startl=i;
endr=i-1;
flag2=1;
}
//--------------------------------------------------------------------------------------------------------
}
cout << startr+1<<" "<<startl;
}