-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1779A.cpp
More file actions
37 lines (34 loc) · 781 Bytes
/
Copy path1779A.cpp
File metadata and controls
37 lines (34 loc) · 781 Bytes
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
37
// Created on 02-Nov-24
//done
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
int main() {
int t;
cin >> t;
while (t--) {
int n;
string s;
cin >> n >> s;
bool flag = false;
for (int i = 0; i < n - 1; i++) {
if (s[i] == s[i + 1]) continue;
else {
flag = true;
break;
}
}
if (flag) {
size_t find = s.find("RL");
if (find != string::npos)
cout << "0" << endl;
else {
size_t find2 = s.find("LR");
cout << find2+1 << endl;
}
} else cout << "-1" << endl;
}
return 0;
}