QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#163156#5078. Castle Designstd_absAC ✓17ms9440kbC++203.5kb2023-09-03 21:32:512023-09-03 21:32:52

Judging History

你现在查看的是最新测评结果

  • [2023-09-03 21:32:52]
  • 评测
  • 测评结果:AC
  • 用时:17ms
  • 内存:9440kb
  • [2023-09-03 21:32:51]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) ((int)a.size())
const int mod = 998244353, N = 100001;

typedef pair<int, int> pi;

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	string s;
	cin >> s;
	int n = s.length(), a[n];
	a[0] = 0;
	for (int i = 1; i < n; ++i)
		a[i] = (a[i - 1] + (s[i] == 'L' ? 1 : 3)) % 4;
	int x = 2;
	while (a[x] == a[0])
		x += 2;
	int y = x + 2;
	while (y < n && a[y] == a[x])
		y += 2;
	bool is2 = true;
	for (int i = y; i < n; i += 2)
		if (a[i] != a[0])
			is2 = false;
	if (!is2) {
		x = 3;
		while (a[x] == a[1])
			x += 2;
		int b[n];
		for (int i = 0; i < n; ++i)
			b[i] = a[(x + i) % n];
		for (int i = 0; i < n; ++i)
			a[i] = b[i];
		// 10121012..30323032...
	}
	else {
		int x = 1, b[n];
		for (int i = 0; i < n; ++i)
			b[i] = a[(x + i) % n];
		for (int i = 0; i < n; ++i)
			a[i] = b[i];
		x = 2;
		while (a[x] == a[0])
			x += 2;
		int y = x + 2;
		while (y < n && a[y] == a[x])
			y += 2;
		for (int i = y; i < n; i += 2)
			if (a[i] != a[0])
				is2 = false;
		if (!is2) {
			x = 3;
			while (a[x] == a[1])
				x += 2;
			int b[n];
			for (int i = 0; i < n; ++i)
				b[i] = a[(x + i) % n];
			for (int i = 0; i < n; ++i)
				a[i] = b[i];
			// 10121012..30323032...
		}
		else {
			// t=2
			int cnt[4]{};
			for (int i = 0; i < n; ++i)
				++cnt[a[i]];
			int ans = max(cnt[0], cnt[2]) + max(cnt[1], cnt[3]);
			ans *= 2;
			if (cnt[0] == cnt[2] && cnt[1] == cnt[3]) {
				set<pi> s;
				int x = 0, y = 0;
				for (int i = 0; i < n; ++i) {
					if (a[i] == 0)
						++x;
					else if (a[i] == 1)
						++y;
					else if (a[i] == 2)
						--x;
					else
						--y;
					if (s.count({x, y})) {
						ans += 2;
						break;
					}
					s.insert({x, y});
				}
			}
			cout << ans << '\n';
			return 0;
		}
	}
	for (int i = 1; i < n; ++i)
		(a[i] += 4 - a[0]) %= 4;
	a[0] = 0;
	x = 0;
	vector<int> v[2];
	for (int i = 0; i < n; ++i) {
		if (i & 1) {
			if (!x)
				v[0].push_back(a[i] == a[n - 1] ? 1 : -1);
			else
				v[1].push_back(a[i] == a[n - 1] ? 1 : -1);
		}
		else if (a[i] != a[0])
			x = 1;
	}
	v[0].pop_back(), v[1].pop_back();
	reverse(all(v[1]));
	if (v[0].size() > v[1].size())
		swap(v[0], v[1]);
	int dp[N][2], inf = 0x3f3f3f3f;
	for (int j = 0; j <= v[1].size(); ++j)
		dp[j][0] = inf;
	dp[0][0] = 0;
	vector<int> pre[2];
	for (int i = 0; i < 2; ++i) {
		pre[i].push_back(0);
		for (int j = 0; j < v[i].size(); ++j)
			pre[i].push_back(pre[i].back() + v[i][j]);
	}
	for (int j = 0; j < v[1].size(); ++j) {
		int _j = j & 1, nxt = !_j;
		for (int i = 0; i <= v[0].size(); ++i)
			dp[i][nxt] = inf;
		for (int i = 0; i <= v[0].size(); ++i) {
			int dis = pre[0][i] + pre[1][j] + 1 + dp[i][_j];
			dp[i][nxt] = min(dp[i][nxt], dp[i][_j] + (dis + v[1][j] <= 0 ? 1 : 0));
			dp[i + 1][nxt] = min(dp[i + 1][nxt], dp[i][_j] + (dis + v[0][i] + v[1][j] <= 0 ? 1 - (dis + v[0][i] + v[1][j]) : (dis + v[0][i] + v[1][j] == 1 && dis == 1 ? 1 : 0)));
		}
	}
	int cnt[4]{};
	for (int i = 0; i < n; ++i)
		++cnt[a[i]];
	int dis = pre[0][v[0].size()] + pre[1][v[1].size()] + 1 + dp[v[0].size()][v[1].size() & 1];
	//cout << dis << '\n';
	int ans = 2 * max(cnt[0], cnt[2]) + cnt[1] + cnt[3] + dp[v[0].size()][v[1].size() & 1] + dis - 1;
	cout << ans << '\n';
	//cout << dp[v[0].size()][v[1].size() & 1] << '\n';
	//cout << 2 * max(cnt[0], cnt[2]) + cnt[1] + cnt[3] << '\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4456kb

input:

LLRLLRLLRLRLLR

output:

16

result:

ok single line: '16'

Test #2:

score: 0
Accepted
time: 1ms
memory: 4424kb

input:

RLLRLLLRRLLRLRLL

output:

20

result:

ok single line: '20'

Test #3:

score: 0
Accepted
time: 1ms
memory: 4348kb

input:

LLRRLLLLRRLL

output:

16

result:

ok single line: '16'

Test #4:

score: 0
Accepted
time: 1ms
memory: 4432kb

input:

RLLRLLRLLRLL

output:

12

result:

ok single line: '12'

Test #5:

score: 0
Accepted
time: 2ms
memory: 5504kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

199996

result:

ok single line: '199996'

Test #6:

score: 0
Accepted
time: 2ms
memory: 5572kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

155164

result:

ok single line: '155164'

Test #7:

score: 0
Accepted
time: 2ms
memory: 5268kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

189748

result:

ok single line: '189748'

Test #8:

score: 0
Accepted
time: 2ms
memory: 5312kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

137900

result:

ok single line: '137900'

Test #9:

score: 0
Accepted
time: 7ms
memory: 7852kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

100002

result:

ok single line: '100002'

Test #10:

score: 0
Accepted
time: 1ms
memory: 5332kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

134442

result:

ok single line: '134442'

Test #11:

score: 0
Accepted
time: 2ms
memory: 5576kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

112388

result:

ok single line: '112388'

Test #12:

score: 0
Accepted
time: 2ms
memory: 4872kb

input:

LLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

10004

result:

ok single line: '10004'

Test #13:

score: 0
Accepted
time: 1ms
memory: 4444kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

17478

result:

ok single line: '17478'

Test #14:

score: 0
Accepted
time: 2ms
memory: 4980kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

10006

result:

ok single line: '10006'

Test #15:

score: 0
Accepted
time: 0ms
memory: 4668kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

40004

result:

ok single line: '40004'

Test #16:

score: 0
Accepted
time: 1ms
memory: 4636kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

30730

result:

ok single line: '30730'

Test #17:

score: 0
Accepted
time: 4ms
memory: 5544kb

input:

LLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

20004

result:

ok single line: '20004'

Test #18:

score: 0
Accepted
time: 1ms
memory: 4572kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

27698

result:

ok single line: '27698'

Test #19:

score: 0
Accepted
time: 1ms
memory: 4632kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

33668

result:

ok single line: '33668'

Test #20:

score: 0
Accepted
time: 2ms
memory: 5012kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

20010

result:

ok single line: '20010'

Test #21:

score: 0
Accepted
time: 0ms
memory: 4328kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

3874

result:

ok single line: '3874'

Test #22:

score: 0
Accepted
time: 0ms
memory: 4436kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

2704

result:

ok single line: '2704'

Test #23:

score: 0
Accepted
time: 1ms
memory: 4384kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

2848

result:

ok single line: '2848'

Test #24:

score: 0
Accepted
time: 1ms
memory: 4800kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

33368

result:

ok single line: '33368'

Test #25:

score: 0
Accepted
time: 1ms
memory: 4880kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

36144

result:

ok single line: '36144'

Test #26:

score: 0
Accepted
time: 1ms
memory: 4676kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

3116

result:

ok single line: '3116'

Test #27:

score: 0
Accepted
time: 1ms
memory: 4380kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

4804

result:

ok single line: '4804'

Test #28:

score: 0
Accepted
time: 1ms
memory: 4548kb

input:

LLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

2404

result:

ok single line: '2404'

Test #29:

score: 0
Accepted
time: 1ms
memory: 4668kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

33388

result:

ok single line: '33388'

Test #30:

score: 0
Accepted
time: 1ms
memory: 4628kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLL

output:

288

result:

ok single line: '288'

Test #31:

score: 0
Accepted
time: 1ms
memory: 4444kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

4068

result:

ok single line: '4068'

Test #32:

score: 0
Accepted
time: 4ms
memory: 6304kb

input:

LLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

40004

result:

ok single line: '40004'

Test #33:

score: 0
Accepted
time: 1ms
memory: 4840kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

60744

result:

ok single line: '60744'

Test #34:

score: 0
Accepted
time: 4ms
memory: 5700kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

40410

result:

ok single line: '40410'

Test #35:

score: 0
Accepted
time: 1ms
memory: 4872kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

88004

result:

ok single line: '88004'

Test #36:

score: 0
Accepted
time: 1ms
memory: 5100kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

79904

result:

ok single line: '79904'

Test #37:

score: 0
Accepted
time: 2ms
memory: 5004kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

114084

result:

ok single line: '114084'

Test #38:

score: 0
Accepted
time: 0ms
memory: 5012kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

66646

result:

ok single line: '66646'

Test #39:

score: 0
Accepted
time: 2ms
memory: 4956kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

93288

result:

ok single line: '93288'

Test #40:

score: 0
Accepted
time: 1ms
memory: 5040kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

128004

result:

ok single line: '128004'

Test #41:

score: 0
Accepted
time: 2ms
memory: 5016kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

89292

result:

ok single line: '89292'

Test #42:

score: 0
Accepted
time: 3ms
memory: 6588kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

66674

result:

ok single line: '66674'

Test #43:

score: 0
Accepted
time: 14ms
memory: 8416kb

input:

LLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

80004

result:

ok single line: '80004'

Test #44:

score: 0
Accepted
time: 2ms
memory: 5180kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

120294

result:

ok single line: '120294'

Test #45:

score: 0
Accepted
time: 1ms
memory: 5188kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

135798

result:

ok single line: '135798'

Test #46:

score: 0
Accepted
time: 1ms
memory: 4496kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

11576

result:

ok single line: '11576'

Test #47:

score: 0
Accepted
time: 1ms
memory: 4424kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

806

result:

ok single line: '806'

Test #48:

score: 0
Accepted
time: 1ms
memory: 5164kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

122092

result:

ok single line: '122092'

Test #49:

score: 0
Accepted
time: 1ms
memory: 4512kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

17604

result:

ok single line: '17604'

Test #50:

score: 0
Accepted
time: 17ms
memory: 9440kb

input:

LLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

99996

result:

ok single line: '99996'

Test #51:

score: 0
Accepted
time: 0ms
memory: 4656kb

input:

LLLL

output:

4

result:

ok single line: '4'

Test #52:

score: 0
Accepted
time: 0ms
memory: 4440kb

input:

LLRLRLLRLRRLRLRLRLRLRLRLRLRLLRRLLRRLRLRLRLLRLRLRRLLRLRLRLRRLLRRLRLLRLRRLLRLRRLRLRLLRLRRLLRLRRLLRRLRLLRRLRLLRLRRLLRRLRLRLLRLRRLLRRLRLLRRLRLRLLRLRRLLRRLRLRLLRLRRLRLRLLRLRLRLRRLRLLRRLRLRLRLRLRLRLLRLRLRLRLRRLRLLRRLLRRLRLRLLRLRLRRLRLLRRLLRRLLRLRLRRLLRLRRLRLLRLRLRRLRLRLRLRLLRLRLRRLRLLRRLRLRLLRLRRLRLRLRLLR...

output:

1044

result:

ok single line: '1044'

Test #53:

score: 0
Accepted
time: 1ms
memory: 4436kb

input:

LLLRRLLRLRRLRLLRRLLRLRLRRLLRRLRLRLRLRLRLRLLRLRLRLRRLLRLRRLRLRLLRRLLRLRRLRLRLLRRLLRLRRLLRLLLRLRRLLRRLLRRLLRLRRLRLLRRLLRLRLRLRRLRLRLLRRLLRLRLRRLRLRLLRRLRLLRLRRLLRRLRLRLLRLRLRLRLRLRRLRLRLRLRLRLRLLRLRRLLRRLLRRLRLLRLRLRRLLRRLRLLRLRRLRLLRRLLRRLLRLRLRLRRLRLRLRLRLRLLRRLLRRLRLLRRLLRLRRLLRRLLRRLLRRLLRRLLRLRLR...

output:

1442

result:

ok single line: '1442'

Test #54:

score: 0
Accepted
time: 1ms
memory: 4420kb

input:

LLLRLRLRRLLRLRLRRLLRLRLRLRRLRLLRLRRLRLLRLRLRRLRLRLLRRLRLLRRLRLLRLRRLLRLRRLLRLRLRLRLRRLLRRLLRRLRLRLLRLRRLRLLRRLLRRLRLRLRLRLRLRLLRRLLRLRRLLRLRRLLRLRRLRLLRRLRLRLRLLRLRLRLRLRLRLRLRLRRLLRRLLRLRRLRLLRLRLRLRLRLRRLRLLRRLLRLRLRRLLRRLLRLRLRRLLRRLRLLRRLLRRLLRRLLRRLRLRLLRRLRLLRLRRLRLLRLRLRRLLRRLRLLRRLLRLRLRLRRL...

output:

1578

result:

ok single line: '1578'

Test #55:

score: 0
Accepted
time: 1ms
memory: 4692kb

input:

LLRLLRLRLRLRRLRLRLLRRLRLLRLRRLLRRLRLLRLRRLLRRLLRRLRLLRLRLRLRLRLRRLLRRLLRRLLRLRRLRLLRLRRLLRRLRLLRRLRLLRRLRLLRLRLRRLRLRLRLLRRLRLLRRLLRLRRLRLRLRLLRLRRLRLLRLRRLRLLRRLRLRLLRLRLRRLLRLRLRRLRLLRRLLRLRRLLRRLRLLRLRRLRLLRRLRLLRRLLRLRLRLRRLRLLRRLRLLRRLLRLRLRRLRLRLLRRLRLLRLRLRRLRLLRRLRLLRLRRLLRLRRLLRLRRLLRLRLRLR...

output:

2910

result:

ok single line: '2910'

Test #56:

score: 0
Accepted
time: 2ms
memory: 4456kb

input:

LLRLRLRLLRRLLRLRLRRLRLRLLRRLLRLRLRLRLRRLLRRLRLRLLRRLRLRLRLLRRLRLRLRLLRLRRLRLLRLRRLLRRLLRRLRLLRRLRLRLRLRLLRLRRLRLLRLRLRRLRLRLRLRLRLLRRLLRLRRLLRLRRLLRLRLRRLRLLRRLLRRLRLLRRLRLLRRLRLRLLRRLLRLRLRLRRLLRRLRLRLRLRLLRLRRLLRRLRLRLRLLRRLLRRLRLRLRLLRLRRLRLLRRLLRRLRLLRLRRLLRLRRLLRRLLRRLRLLRLRLRLRRLLRRLLRLRLRLRLR...

output:

2040

result:

ok single line: '2040'

Test #57:

score: 0
Accepted
time: 1ms
memory: 4372kb

input:

LLLRRLLRLRLRRLLRLRRLLRLRLRRLLRLRLRRLRLLRLRRLLRRLRLLRLRLRLRLRLRLRLRLRLRRLLRRLRLRLRLLRLRLRRLLRRLLRLRRLRLRLLRRLRLLRLRLRRLLRLRRLLRLRRLLRRLRLRLLRLRLLRLLRLRRLRLLRRLRLRLLRRLLRLRRLLRRLRLRLLRRLLRRLRLRLRLRLRLRLLRRL

output:

270

result:

ok single line: '270'

Test #58:

score: 0
Accepted
time: 1ms
memory: 4400kb

input:

LLLRRLLRLRLRRLRLLRLRRLLRRLLRLRLRRLLRLRLRRLLRRLRLRLRLLRRLLRRLRLLRLRRLRLRLRLRLRLLRRLRLRLRLRLLRRLLRRLRLLRLRRLLRLRLRRLLRLRLLLRRLRLRLLRRLRLRLRLRLRLLRRLRLRLLRLRRLRLRLLRRLLRRLRLLRRLRLRLRLLRRLRLLRLRLRLRRLLRLRRLLR

output:

228

result:

ok single line: '228'

Test #59:

score: 0
Accepted
time: 1ms
memory: 4360kb

input:

LLLRRLLRLRLRLRLLRLLRRLRL

output:

32

result:

ok single line: '32'

Test #60:

score: 0
Accepted
time: 2ms
memory: 4700kb

input:

LLLRLRRLRLRLLRLRLRLRRLLRRLRLRLRLRLLRLRLRRLLRLRLRRLLRRLRLLRRLLRRLLRRLLRRLLRRLLRLRLRLRRLRLLRLRLRRLLRRLRLLRRLLRRLLRRLLRRLRLRLLRLRLRRLLRLRLRLRRLRLRLLRLRRLRLLRLRRLLRLRLRRLRLLRRLRLRLRLLRLRRLRLLRLRRLRLLRRLLRLRRLRLRLRLRLRLLRRLRLRLRLRLLRRLRLLRRLRLLRLRRLRLLRRLLRLRLRRLLRLRRLLRRLRLRLRLRLRLRLLRLRLRLRRLLRLRLRRLRL...

output:

3486

result:

ok single line: '3486'

Test #61:

score: 0
Accepted
time: 3ms
memory: 4732kb

input:

LLLRRLRLLRRLRLLRLRLRLRLRLRLRRLRLRLLRRLLRLRLRRLRLLRRLLRLRLRLRLRLRLRLRLRRLLRRLLRLRRLRLRLRLLRRLRLRLRLRLLRLRLRRLRLLRRLLRLRRLLRLRLRRLLRLRRLRLLRLRLRLRLRRLRLRLRLLRLRLRRLRLRLRLRLLRRLRLRLRLRLLRRLRLLRLRLRRLRLRLLRRLRLRLLRRLLRLRLRRLLRLRRLRLLRLRRLLRRLRLRLLRRLRLLRRLRLRLRLLRLRLRRLRLLRLRLRLRRLLRRLLRRLLRLRLRRLLRRLLR...

output:

4834

result:

ok single line: '4834'

Test #62:

score: 0
Accepted
time: 3ms
memory: 4492kb

input:

LLRLLRRLRLLRRLLRLRRLRLRLRLLRRLRLRLRLLRRLLRRLRLRLRLRLRLLRRLRLLRLRLRLRLRRLRLRLRLLRLRRLLRLRLRLRLRRLLRRLRLLRLRLRRLLRLRRLRLLRLRLRRLRLRLRLLRLRRLRLLRRLRLRLLRRLRLLRRLRLRLLRLRRLLRLRLRLRRLLRRLLRRLRLRLRLRLLRRLRLRLLRRLRLLRRLRLRLLRLRLRLRLRRLLRLRRLRLRLRLLRRLRLLRLRRLRLLRRLRLLRRLRLLRLRRLRLRLRLRLLRLRLRRLRLLRRLRLLRLR...

output:

5156

result:

ok single line: '5156'

Test #63:

score: 0
Accepted
time: 5ms
memory: 4484kb

input:

LLRLLRLRLRLRLRLRLRRLLRLRRLLRLRLRRLLRLRLRLRLRLRLRRLLRRLLRLRRLLRLRLRRLRLLRRLRLRLLRLRLRRLRLRLLRRLRLRLRLRLLRRLLRRLLRRLLRRLLRLRRLLRRLLRRLLRRLRLLRLRLRLRRLLRLRLRLRLRLRRLRLLRLRRLRLLRRLLRLRLRLRRLLRLRLRRLRLLRLRRLLRLRLRRLRLRLRLRLLRRLRLRLLRRLRLLRLRLRRLLRLRLRLRLRLRLRLRLRRLLRRLRLRLLRLRLRRLLRLRRLLRLRLRLRLRRLRLLRRL...

output:

5564

result:

ok single line: '5564'

Test #64:

score: 0
Accepted
time: 2ms
memory: 4776kb

input:

LLLRRLRLRLLRLRRLLRRLLRRLLRRLLRLRRLRLLRRLRLRLRLLRLRRLRLLRRLRLRLRLLRLRLRLRRLRLRLLRLRLRRLLRLRRLLRLRRLLRRLLRLRLRLRLRLRRLLRRLLRRLLRLRLRRLLRRLRLLRRLLRRLLRRLLRLRRLLRLRRLLRRLRLLRRLLRLRRLLRLRRLLRLRRLRLLRLRRLRLRLLRLRLRRLRLLRLRLRRLLRLRRLRLRLRLLRRLRLLRLRRLLRLRLRLRLRRLLRRLRLRLRLLRLRRLRLRLRLLRRLRLRLRLRLLRLRLRRLLR...

output:

7944

result:

ok single line: '7944'

Test #65:

score: 0
Accepted
time: 5ms
memory: 4772kb

input:

LLLRRLRLRLLRLRLRRLLRRLLRLRRLLRLRRLLRLRLRRLRLLRRLLRRLLRLRLRRLLRLRLRRLRLLRLRLRRLLRLRLRLRLRRLLRLRLRRLLRLRLRLRRLLRLRLRRLRLLRRLRLLRRLLRLRLRRLRLRLRLLRLRLRRLRLRLLRLRLRLRLRLRRLRLRLLRRLRLLRLRRLLRRLRLRLRLRLLRLRRLLRRLRLRLRLLRLRRLLRRLRLRLRLRLLRLRRLLRRLRLLRLRLRLRLRLRRLRLLRLRLRLRLRRLLRRLLRLRRLLRLRLRLRLRRLLRLRLRRL...

output:

7544

result:

ok single line: '7544'

Test #66:

score: 0
Accepted
time: 9ms
memory: 4788kb

input:

LLLRRLLRLRRLLRRLLRLRLRLRLRLRRLRLRLLRLRRLLRLRLRLRRLLRRLRLLRLRLRRLLRRLLRLRLRRLLRRLRLLRLRLRRLRLRLRLLRRLRLLRRLLRRLLRLRLRLRLRLRLRLRRLLRLRLRLRLRRLRLLRLRRLLRRLRLLRLRLRRLLRLRLRLRLRLRLRLRRLLRLRRLLRRLRLRLRLLRLRLRLRRLRLRLLRRLLRLRLRLRLRLRLRLRLRRLLRRLRLRLLRLRRLRLRLLRRLRLRLLRLRLRLRLRRLLRLRLRLRLRRLRLRLLRLRLRRLLRLR...

output:

7942

result:

ok single line: '7942'

Test #67:

score: 0
Accepted
time: 9ms
memory: 4448kb

input:

LLLRLRRLRLRLRLRLLRRLLRRLRLRLLRLRRLLRRLLRRLRLRLRLLRRLRLRLLRRLLRRLLRRLLRLRRLRLLRRLRLRLRLLRLRLRLRRLRLRLLRRLLRLRLRLRRLLRRLLRRLLRLRRLLRRLLRLRLRRLRLLRLRLRRLLRLRLRLRLRLRLRRLRLRLRLLRRLRLRLRLLRLRLRLRLRLRRLRLRLLRLRLRLRLRLRLRRLLRRLLRRLRLLRRLRLLRRLLRLRRLLRLRRLRLRLRLRLLRRLLRLRLRLRLRLRLRRLLRRLRLLRRLRLRLRLLRLRRLRL...

output:

10056

result:

ok single line: '10056'

Test #68:

score: 0
Accepted
time: 12ms
memory: 4576kb

input:

LLLRRLRLLRRLLRLRLRLRLRRLRLRLRLRLRLRLRLLRLRRLRLRLRLRLRLRLLRRLLRRLLRRLRLLRLRRLRLRLLRRLRLRLRLRLRLLRRLLRLRRLRLLRRLLRRLLRLRLRRLLRLRRLLRRLLRLRLRLRRLRLLRRLRLRLRLLRRLRLLRLRRLLRRLLRLRLRLRLRRLLRLRRLRLRLRLRLLRRLLRLRLRRLRLRLLRLRLRLRRLRLRLLRLRRLLRRLRLRLRLLRLRLRLRRLLRRLLRLRRLLRLRRLRLLRLRRLLRRLRLLRLRLRRLRLRLRLRLLR...

output:

8154

result:

ok single line: '8154'

Test #69:

score: 0
Accepted
time: 13ms
memory: 4604kb

input:

LLLRRLLRLRLRRLLRRLLRRLRLLRLRRLLRLRLRLRRLRLRLLRLRLRRLLRRLLRRLLRRLLRRLLRLRLRRLRLRLLRRLRLLRRLRLLRLRLRRLRLRLRLRLLRLRRLRLRLRLRLRLLRLRRLRLLRLRLRRLLRLRRLLRRLLRLRLRRLLRRLLRRLLRLRRLLRLRRLLRLRRLRLRLRLLRRLRLLRRLRLRLRLRLLRRLRLLRLRLRLRRLLRLRLRRLLRRLRLRLLRLRRLLRLRRLRLRLRLLRLRRLLRLRRLLRLRLRLRLRRLLRRLLRLRRLRLRLLRLR...

output:

10130

result:

ok single line: '10130'

Test #70:

score: 0
Accepted
time: 12ms
memory: 4544kb

input:

LLLRLRRLLRRLRLLRLRLRRLLRLRRLLRLRRLLRLRLRLRRLRLRLRLLRLRLRLRLRRLRLLRLRRLRLLRLRLRLRLRRLRLRLLRLRRLRLLRLRRLRLLRRLLRLRRLRLRLLRLRLRLRRLRLLRLRLRLRLRLRRLRLLRRLLRRLRLLRRLLRLRLRRLLRRLRLRLRLLRRLRLRLLRLRLRRLRLLRLRRLLRRLRLLRLRLRRLLRRLLRRLRLLRRLLRRLRLLRLRLRLRLRRLRLRLLRRLLRLRRLRLLRRLRLLRRLLRRLRLRLLRRLLRLRRLLRLRRLLR...

output:

11160

result:

ok single line: '11160'

Test #71:

score: 0
Accepted
time: 9ms
memory: 4648kb

input:

LLLRRLRLRLLRRLLRRLRLLRLRLRLRLRLRLRLRLRLRLRRLRLLRRLRLRLLRRLRLRLLRRLLRLRLRLRRLLRRLRLLRLRLRRLRLRLLRLRRLRLRLRLLRRLLRRLLRRLLRLRLRRLLRRLRLLRLRRLLRRLLRRLRLRLRLRLLRRLLRLRLRRLRLRLLRRLRLRLRLLRRLRLRLLRLRRLLRRLLRRLLRRLRLRLLRLRRLRLLRLRLRLRRLRLRLLRRLLRRLLRRLLRLRRLLRLRRLRLRLRLRLRLLRLRLRRLLRRLLRLRRLRLLRLRRLRLRLRLLR...

output:

13682

result:

ok single line: '13682'

Test #72:

score: 0
Accepted
time: 6ms
memory: 4848kb

input:

LLLRRLLRRLLRRLLRRLRLRLLRRLRLRLRLLRLRRLLRRLRLLRRLRLRLLRLRRLRLRLRLRLRLLRLRLRLRRLRLRLRLRLRLLRRLLRRLRLRLRLRLLRLRRLRLLRRLRLLRRLRLRLRLRLRLLRLRRLRLLRRLRLRLRLRLRLRLLRLRRLLRLRRLLRLRRLRLRLLRLRRLLRRLRLLRLRLRLRLRLRRLRLRLRLRLRLRLRLLRLRRLLRRLRLLRRLLRLRRLRLLRRLRLLRRLLRLRLRLRRLRLLRLRLRRLRLLRLRRLLRLRLRLRLRRLRLRLRLLR...

output:

13578

result:

ok single line: '13578'

Test #73:

score: 0
Accepted
time: 12ms
memory: 4584kb

input:

LLRLLRRLRLRLRLLRLRLRRLLRLRLRRLRLLRRLRLRLRLLRLRLRLRRLRLRLRLLRRLLRRLLRRLLRLRLRRLRLRLRLRLLRRLLRLRLRLRLRRLLRRLRLRLRLLRLRRLLRRLLRRLLRRLLRRLRLLRRLLRRLRLLRRLRLLRRLRLLRLRRLLRRLLRRLRLLRLRRLRLLRLRRLLRLRLRRLLRLRLRLRLRLRRLLRLRLRLRLRLRRLLRLRLRLRLRRLLRRLRLLRLRRLRLLRLRLRRLLRLRRLRLLRRLLRLRLRLRLRRLRLLRLRRLRLLRRLLRRL...

output:

11296

result:

ok single line: '11296'

Test #74:

score: 0
Accepted
time: 1ms
memory: 4424kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRLRLRLRLLLRLRLRLRLRLRLRLRLRLRLRLRLLRLRLRLRLRLRLRLRLRLRLRLR

output:

102

result:

ok single line: '102'

Test #75:

score: 0
Accepted
time: 1ms
memory: 4436kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

1006

result:

ok single line: '1006'

Test #76:

score: 0
Accepted
time: 0ms
memory: 4624kb

input:

LLLRLRLRRLRLRLLLRLRLRLLRLRLR

output:

30

result:

ok single line: '30'

Test #77:

score: 0
Accepted
time: 17ms
memory: 4752kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

9998

result:

ok single line: '9998'

Test #78:

score: 0
Accepted
time: 1ms
memory: 4424kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR

output:

168

result:

ok single line: '168'

Test #79:

score: 0
Accepted
time: 4ms
memory: 4428kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

4008

result:

ok single line: '4008'

Test #80:

score: 0
Accepted
time: 11ms
memory: 4772kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

8008

result:

ok single line: '8008'

Test #81:

score: 0
Accepted
time: 0ms
memory: 4656kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

1604

result:

ok single line: '1604'

Test #82:

score: 0
Accepted
time: 1ms
memory: 4384kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

1606

result:

ok single line: '1606'

Test #83:

score: 0
Accepted
time: 13ms
memory: 4520kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

9606

result:

ok single line: '9606'