Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
void solve() {
string s;
cin >> s;
long long ans = 1;
long long cur = 0;
for (auto u : s) {
if (u == 'R') {
ans = max(ans, cur + 1);
cur = 0;
} else
cur++;
}
ans = max(cur + 1, ans);
cout << ans << "\n";
return;
}
signed main() {
... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.InputMismatchException;
public class C {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
InputReader s = new InputReader(System.in);
Print... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | n = int(input())
for _ in range(n):
s = input()
LL = 0
need = 0
for i in s:
if i == "L":
LL += 1
else:
need = max(need, LL)
LL = 0
need = max(need, LL)
print(need + 1) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main
{
public static void main(String[] args)
{
InputStream inputStream = Syste... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | x=int(input())
for i in range(x):
s=input()
t=1
l=[]
for i in range(len(s)-1):
if s[i]=="L" and s[i+1]=="L":
t+=1
else:
l.append(t)
t=1
l.append(t)
if s.find("L")==-1:
print(max(l))
... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
for (int j = 0; j < t; j++) {
string s;
cin >> s;
vector<int> d(s.size());
;
int k = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] == 'L')
d[k]++;
else
k++;
}
cout << *max_ele... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import sys
n = int(sys.stdin.readline())
for _ in range(n):
s = sys.stdin.readline().strip()
mx = 0
temp = 0
for i in s:
#print(i)
if i == 'L':
temp += 1
mx = max(mx, temp)
else: temp = 0
print(mx + 1) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | t=int(input())
ans=[]
for _ in range(t):
s=list(input())
# print(s)
count=0
max=0
for i in range(len(s)):
# print(s[i])
if(s[i]=='L'):
count+=1
# print(count)
# print(count)
else:
if(count>max):
max=count
... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import sys
get_string = lambda: sys.stdin.readline().strip()
get_int_list = lambda: list( map(int,sys.stdin.readline().strip().split()) )
get_int = lambda: int(sys.stdin.readline())
#--------------------------------WhiteHat010--------------------------------------#
for _ in range(get_int()):
s = 'R'+get_string()+... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | // Don't place your source in a package
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
// Please name your class Main
public class Main {
public static void main (String[] args) throws java.lang.Exception {
Scanner in = new Scanner(System.in);
//InputReader in = new InputReader(S... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | for _ in range(int(input())):
s = input()
count, k = set(), 0
for elem in s:
if elem == 'L':
k += 1
else:
count.add(k)
k = 0
count.add(k)
print(str(max(count) + 1))
| PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | for _ in range(int(input())):
print(max(map(len,input().split('R')))+1) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
string s;
int n;
int main() {
int t;
cin >> t;
while (t--) {
string x;
cin >> x;
n = x.length();
s = "0" + x;
int c = 0, mx = 0;
for (int i = n; i >= 0; i--) {
if (s[i] == 'R' || s[i] == '0') {
c++;
if (c > mx) mx = c;
... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.io.*;
import java.util.StringTokenizer;
public class Codeforces1324C {
public static void main(String[] args) throws IOException {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
int claims = in.nextInt();
for (int j = 0; j < c... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | # https://codeforces.com/problemset/problem/1324/C
t = int(input().strip())
for _ in range(t):
s = input().strip()
s+="R"
counter = 0
ans = 0
for i in range(len(s)):
counter+=1
if s[i]=="R":
ans = max(ans,counter)
counter = 0
print(ans)
| PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | for _ in range(input()):
hops = []
move = raw_input(); size = len(move)
first,second = move.find('R'),move.rfind('R')
if first + second < 0: print size+1
else:
if first == second : print max(first+1,size - second)
else:
hops.append((first+1,first))
for x,y i... | PYTHON |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | def solve(path):
path = "R" + path
indexes_of_R = [i for i in range(len(path)) if path[i] is "R"] + [len(path)]
apart = [indexes_of_R[j + 1] - indexes_of_R[j] for j in range(len(indexes_of_R) - 1)]
return max(apart)
t = int(input())
for i in range(t):
path = input()
y = solve(path)
prin... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | for _ in range(int(input())):
a=input()
d=1
dmax=1
for i in a:
if i=='L':
d+=1
else:
if dmax<d:
dmax=d
d=1
if dmax<d:
dmax=d
print(dmax) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
inline int read() {
char ch = getchar();
int nega = 1;
while (!isdigit(ch)) {
if (ch == '-') nega = -1;
ch = getchar();
}
int ans = 0;
while (isdigit(ch)) {
ans = ans * 10 + ch - 48;
ch = getchar();
}
if (nega == -1) return -ans;
return ans... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
s.push_back('R');
int cur = 0;
int mx = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] == 'R') {
mx = max(mx, i... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
template <typename T>
void __f(const char*, T&&);
template <typename T1, typename... T2>
void __f(const char*, T1&&, T2&&...);
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
int n = s.le... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | for _ in range(int(input())):
l = input()
temp = 0
ans = 0
var = -1
for i in range(len(l)-1,-1,-1):
if l[i]=='R':
var = i
break
for i in range(len(l)):
if l[i]=='R':
ans = max(ans,i+1-temp)
temp = i+1
ans = max(ans,len(l)-var)
... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.lang.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
public class Contest {
//static ArrayList<Integer> prime=new ArrayList();
public static TreeMap<Long,Integer> t1=new TreeM... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
;
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
int n = s.length();
int l = 0, ml = INT_MIN;
for (int i = 0; i < n; ++i) {
if (s[i] == 'L') {
l... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.util.*;
public class Set_prac {
public static void main(String args[]) {
Scanner in=new Scanner (System.in);
int t=in.nextInt();
while(--t>=0) {
String s='R'+in.next()+'R';
int prev=0,curr=0;
int max=0;
int n=s.length();
for(int i=0;i<n;i++) {
char ch=s.charAt(i);
curr=i;
... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | for i in range(int(input())):
a=input()
a+='R'
r=-1
l=[]
for j in range(0,len(a)):
if a[j]=='R':
l.append(j-r)
r=j
print(max(l)) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | for _ in range(int(input())):
print(1 + max(map(len, input().split('R')))) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 |
t = int(input())
for _ in range(t):
l = list(input())
co_max = 0
co = 1
for i in range(len(l)):
if l[i] == 'R':
co_max = max(co, co_max)
co = 1
else:
co += 1
if l[-1] == 'L':
if co_max < co:
co_max = co
print(co_max)
| PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import sys
import math
#sys.stdin=open("input.in","r")
#sys.stdout=open("output.out","w")
for _ in range(int(input())):
s=list(input())
s.insert(0,"R")
s.append("R")
m=-1
prev=0
for i in range(1,len(s)):
if s[i]=="R":
dist=i-prev
if(dist>m):
m=dist... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.util.Scanner;
public class Main {
static private int n;
static private String s;
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int T = in.nextInt();
in.nextLine();
while (T-- > 0) {
s=in.next();
n=s.length();
//Syst... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 |
from sys import stdin
t = int(input())
for _ in range(t):
seq ,= stdin.readline().split()
seq += 'R'
seq = 'R' + seq
rights = []
for s in range(len(seq)):
if seq[s] == 'R':
rights.append(s)
max_dif = 0
for i in range(len(rights) - 1):
if rights[i + 1] - rights[i] > max_dif:
max_dif = rights[i + ... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.util.*;
public class Check2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++){
String s=sc.next();
if(!s.contains("R")){
System.out.println(s.length()+1);
}... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | n = int(input())
for i in range(n):
s = input()
last_r_idx = -1
maxi = float('-inf')
for i in range(len(s)):
if s[i] == 'R':
maxi = max(maxi, i - last_r_idx)
last_r_idx = i
maxi = max(maxi, len(s) - last_r_idx)
print(maxi)
| PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | for i in range(int(input())):
a=list(input())
if 'R' not in a:
print(len(a)+1)
elif 'L' not in a:
print(1)
else:
t=[]
f=-1
for k in range(len(a)):
if a[k] =='R':
t.append(k-f)
f=k
t.append(a[::-1].index... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.util.*;
import java.math.*;
import java.io.*;
import java.lang.*;
public class Main {
public static void main(String[] args) {
FastReader sc = new FastReader();
int t=sc.nextInt();
while(t-- > 0)
{
String s = sc.next();
s="R"+s+"R"; //adding r to... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
vector<int> v;
string s;
cin >> s;
v.push_back(0);
for (int i = 0; i < s.length(); i++) {
if (s[i] == 'R') v.push_back(i + 1);
}
v.push_back(s.length() + 1);
int maxx = 0;
for (int i... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | // practice with kaiboy
import java.io.*;
import java.util.*;
public class CF1324C extends PrintWriter {
CF1324C() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1324C o = new CF1324C(); o.main(); o.flush();
}
void main() {
int t = sc.nextInt();
while (t... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | t=int(input())
while(t):
t=t-1
s=input()
res=0
l=-1
for i in range(0,len(s)):
if(s[i]=='R'):
res=max(res,i-l)
l=i
res=max(res,len(s)-l)
print(res)
| PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | t = int(input())
for t_ in range(t):
s = list(input())
cnt, ans = 1, 1
for i in s:
if i == 'L':
cnt += 1
elif i == 'R':
ans = max(ans, cnt)
cnt = 1
ans = max(ans, cnt)
print(ans)
| PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | def solve(frog):
diff = [0]
arr=[]
for i,v in enumerate(frog):
if v=='R':
diff.append(i+1)
diff.append(len(frog)+1)
ans = 0
for i in range(len(diff)-1):
ans = max(ans,diff[i+1]-diff[i])
return ans
for _ in range(int(input())):
frog = input()
print(solve(frog)) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | def main():
d = int(input())
for i in range(d):
s = input()
l = 0
res = []
for i, v in enumerate(s):
if v == "R":
res.append(i+1 - l)
l = i+1
res.append(len(s)+1-l)
print(max(res) if res else len(s)+1)
if __name__ == "... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | def ans(l):
print(max(l)+1)
for _ in range(int(input())):
s=input()
ss=s.split("R")
l=list(map(len,ss))
ans(l) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.util.*;
public class Solution{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++) {
String str=sc.next();
int cnt=0,max=0;
for(int j=0;j<str.length();j++) {
if(str.charAt(j)=='L') {
cnt++;
max=Math.max(max,... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
import java.lang.management.*;
import static java.lang.Math.*;
@SuppressWarnings("unchecked")
public class P1324C {
public void run() throws Exception {
for (int t = nextInt(); t > 0; t--) {
int m = 0;
String s = 'R... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
using ll = long long;
using vb = vector<bool>;
using vvb = vector<vb>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vc = vector<char>;
using vvc = vector<vc>;
using... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | for _ in range(int(input())):
s=input()
mn=[]
for i in range(len(s)):
if s[i]=="R":
mn.append(i+1)
mn=[0]+mn+[len(s)+1]
mnd=0
for i in range(1,len(mn)):
mnd=max(mnd,mn[i]-mn[i-1])
print(mnd)
| PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long int t;
cin >> t;
while (t--) {
string s;
cin >> s;
vector<long long int> a;
a.push_back(0);
for (long long int i = 0; i < s.size(); i++) {
if (s... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | from sys import stdin
input = stdin.readline
q = int(input())
for rwewer in range(q):
s = input()
n = len(s)
naj_seg = 1
odp = 1
count = 0
for i in range(n):
if s[i] == "L":
count += 1
else:
naj_seg = max(naj_seg, count + 1)
count = 0
naj_seg = max(naj_seg, count + 1)
print(naj_seg) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | n = int(input())
saida = []
for k in range(n):
entrada = input()
aux = []
i = 0
while i < len(entrada):
s = 0
while entrada[i] == "L":
s += 1
i += 1
if i == len(entrada):
break
if s > 0:
aux.append(s)
else:
... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | t=int(input())
while(t):
t-=1
l=list(input())
n=len(l)
i=0
j=0
ma=0
c=0
while(i<len(l)):
if(l[i]=='L'):
c+=1
if((i+1)<n and l[i+1]!='L'):
if(c>ma):
ma=c
... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | t = int(input())
for _ in range(t):
s = list(input())
try:
k1 = s.index('R')
s.reverse()
k2 = s.index('R')
k3 = 0
if s.count('R')==1:
print(max(k1+1,k2+1))
else:
c = []
for i in range(len(s)):
if s[i]=='R':
... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | from math import *
from collections import *
from operator import itemgetter
import bisect
ii = lambda: int(input())
iia = lambda: list(map(int,input().split()))
isa = lambda: list(input().split())
I = lambda:list(map(int,input().split()))
chrIdx = lambda x: ord(x)-96
idxChr = lambda x: chr(96+x)
t = ii()
for i in ran... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import math
q=int(input())
#q=1
for _ in range(q):
#n=int(input())
#n,m=map(int,input().split())
#l=list(map(int,input().split()))
s=list(input())
n=len(s)
maxx=0
k=0
for i in range(n):
if i==0 and s[i]=='L':
k+=1
elif s[i]=='L' and s[i-1]=='L':
k... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | t = int(input())
for i in range(t):
s = input()
mx = 0
x = 1
for ch in s:
if ch=='L':
x += 1
else:
mx = max(mx, x)
x = 1
mx = max(mx, x)
print(mx) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | def main():
s = input()
s = "R" + s + "R"
ans, run = 0, 0
for i in range(len(s)):
if s[i] == "L":
run += 1
else:
ans = max(ans, run)
run = 0
print(ans + 1)
# main()
for _ in range(int(input())):
main()
| PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.util.*;
public class codeforces {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
int t = input.nextInt();
while(t-->0) {
String s = input.next();
System.out.println(func(s));
}
}
static int func(String s) {
int max = Integer.MIN_VALUE;
int n = s.length... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import math,sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
li = lambda:list(map(int,input().split()))
def case():
a=input().strip()
c=0
m=0
i=0
while(i<len(a)):
if(a[i]=='L'):
if(i==0):
c+=1
... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.util.Scanner;
public class main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int t = input.nextInt();
for (int i = 0; i < t; i++) {
String s = input.next();
String[] list = s.split("");
int d = 0;
int temp = 0;
for (int j = 0; j < list.length; j... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | a = int(input())
for _ in range(a):
vz = 0
vzmax = 0
arryLR = input()
z = len(arryLR)
for i in range(z):
if arryLR[i] == "L":
vz += 1
else:
if vzmax < vz:
vzmax = vz
vz = 0
if vzmax < vz:
vzmax = vz
print(vzmax+1) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | from pprint import pprint
qq = int(input())
import itertools
def countstrs(s):
return [(k, len(list(g))) for k, g in itertools.groupby(s)]
for _ in range(qq):
s = input()
d = countstrs(s)
ma = 0
for k in d:
if k[0] == "L":
ma = max(ma, k[1])
print(ma+1)
| PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 |
import java.io.*;
import java.util.*;
public class FrogJumps {
public static void main(String args[]) {
try{
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
String line;
int nums = Integer.parseInt(buffer.readLine());
for(int ... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
int n;
char c[maxn];
int main() {
ios::sync_with_stdio(0);
int t;
cin >> t;
while (t--) {
cin >> (c + 1);
n = strlen(c + 1);
int lp = 0, mx = 1;
for (int i = 1; i <= n + 1; i++) {
if (i == n + 1 || c[i] == 'R') {
... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | for i in range(int(input())):
s = input()
a = []
a.append(-1)
for j in range(len(s)):
if s[j] == 'R': a.append(j)
a.append(len(s))
print(max([y - x for x, y in zip(a[:-1], a[1:])]))
| PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 |
// package Scheduling;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
String s;
for (int i=0; i!=t; i+=1){
... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 |
t=int(input())
for i in range(0,t):
x=[]
s=input()
for j in range(0,len(s)):
if s[j]=="R":
x.append(j+1)
else:
continue
if len(x)==0:
print(len(s)+1)
else:
y=[x[0],len(s)+1-x[len(x)-1]]
for j in range(0,len(x)-1):
c=x[j+1]... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class problem3 {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(reader.readLine... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | t = int(input())
for i in range(t):
s = str(input())
ans = 0
tmp = 0
for j in range(len(s)):
if s[j] == "L":
tmp += 1
else:
ans = max(tmp, ans)
tmp = 0
print(max(ans, tmp) + 1) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, t;
cin >> t;
while (t--) {
string s;
cin >> s;
n = s.size();
int m = 0, k = 0;
for (int i = 0; i < n; i++) {
if (s[i] == 'L') {
while (s[i] == s[i + 1] && i < n) {
k++;
i++;
m = max(m,... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 |
for _ in range(int(input())):
s=input()
ans=0
cnt=0
for i in s:
if i=='L':
cnt+=1
else:
ans=max(ans,cnt)
cnt=0
ans=max(ans,cnt)
print(ans+1) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #lrllrrllrlr
c=int(input())
for _ in range(0,c):
inp = list(input())
maxl = 0
candidate = 0
for k in inp:
if k == 'L':
candidate += 1
elif k == 'R':
if candidate>maxl:
maxl=candidate
candidate = 0
if candidate>maxl:
m... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | from sys import exit
def i(): return input()
def ii(): return int(input())
def iis(): return map(int, input().split())
def liis(): return list(map(int, input().split()))
def print_array(a): print(" ".join(map(str, a)))
t = ii()
for _ in range(t):
bla = []
s = input()
last = 'R'
count = 0
for i in range(len(s)):
... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | test=int(input())
for index in range(0,test):
inp=input()
temp=[]
temp.append(0)
num=len(inp)
for index in range(0,num):
if inp[index]=='R':
temp.append(index+1)
temp.append(num+1)
maximum=0
lamba=len(temp)
for index in range(0,lamba-1):
maximum=max(temp[i... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long t;
cin >> t;
while (t--) {
string s;
cin >> s;
long long n = s.length();
vector<long long> v;
int g = 0;
v.push_back(0);
for (long long i = 0; i < n; i++) {
if (s[i] == 'R') {
g = 1;
v.push_back(... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | """
Author: guiferviz
Time: 2020-03-19 13:57:43
"""
def solve():
s = input()
nl = 0
max_nl = -1
for i in s:
if i == "L":
nl += 1
else:
nl = 0
max_nl = max(max_nl, nl)
print(max_nl + 1)
def main():
t = int(input())
for _ in range(t):
... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.util.*;
public class Solution{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++ ){
String que=sc.next();
int max=0,count=0;
for(int j=0;j<que.length();j++){
//System.out.println(que.charAt(j)+" "+count);
if(que.charAt(... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import collections
n = input()
for i in range(n):
a = raw_input()
z = 0
maxz = 0
for x in a:
#print "reading ",x
if x == "L":
z+=1
#print "z=",z, "maxz=",maxz
else:
if z>maxz:
maxz=z
z=0
#print "z=",z, "maxz=",maxz
if z>maxz:
maxz=z
print maxz+1
| PYTHON |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #_________________ Mukul Mohan Varshney _______________#
#Template
import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt,floor,factorial,gcd,log,ceil
from collections import deque,Counter,defaultdict
from itertools import permu... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | n = int(input())
for i in range(n):
jumpStr = input().strip()
answer = -1
prev = -1
for j in range(len(jumpStr)):
if (jumpStr[j] == 'R'):
answer = max(answer, j - prev)
prev = j
if (prev == -1):
answer = len(jumpStr) - prev
else:
answer = max(len(jumpStr) - prev, answer)
print(answer) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | t=int(input())
for i in range(t):
x=input()
r=[]
d=[]
for i in range(len(x)):
if x[i]=="R":
r.append(i)
if r:
d.append(r[0]+1)
for i in range(1,len(r)):
d.append(r[i]-r[i-1])
d.append(len(x)-r[-1])
# print(r,d)
print(max(d))
... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int tc;
cin >> tc;
while (tc--) {
string s;
cin >> s;
vector<int> v;
v.push_back(0);
for (int i = 0; i < s.size(); i++) {
if (s[i] == 'R') v.push_back(i + 1);
}
v.push_back(s.size() + 1);
int c = 0;
for (int i = 0... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | def q():
a = input()
p = a.find('R') + 1
b = []
a = list(a)
c = len(a)
if c == 1 and a[0] == 'R':
print(1)
return 0
elif c == 1 and a[0] == 'L':
print(2)
return 0
else:
for i in range(c):
if a[i] == 'R':
b.append(i)
... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | t = int(input())
for i in range(t):
s = input()
flag = True
c = 0
mi = 1
for i in range(len(s)):
if flag and s[i] == "L":
c = 2
flag = False
elif not flag and s[i] == "L":
c += 1
elif not flag and s[i] == "R":
flag = True
... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | t = int(input())
for case_num in range(t):
s = input()
s2 = 'R' + s + 'R'
a = []
for i in range(len(s2)):
if s2[i] == 'R':
a.append(i)
ans = 1
for i in range(len(a) - 1):
ans = max(ans, a[i + 1] - a[i])
print(ans)
| PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int tt;
cin >> tt;
while (tt--) {
string s;
cin >> s;
s = 'R' + s;
int n = s.length();
int rind = -1;
int ans = 0;
for (int i = n - 1; i >= 0; i--) {
if (s[i] == 'R') {
rind = i;
break;
}
}
i... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
int m = 0;
for (int i = s.length(); i >= 0; i--) {
if (s[i] == 'R') {
m = s.length() - i - 1;
break;
}
}
int l = (s[0] == 'L');
int q = l;
for (... | CPP |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | __author__ = 'Devesh Bajpai'
'''
https://codeforces.com/contest/1324/problem/C
Solution:
'''
def solve(s):
max_diff = 0
prev_idx = -1
s = s + 'D' # destination
s = 'S' + s # source
n = len(s)
for i in xrange(0, n):
if s[i] == 'S':
prev_idx = i
elif s[i] ==... | PYTHON |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | t = int(input())
res = []
for z in range(t):
s = input()
s = 'R' + s + 'R'
res.append(0)
for i in range(len(s) - 1):
if(s[i] == 'R'):
j = i + 1
while(s[j] != 'R'):
j += 1
if(res[z] < j - i):
res[z] = j - i
for i in range(t):
... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | n = int(input())
for _ in range(n):
s = input()
s = s.split('R')
ans = 0
for i in s:
ans = max(len(i), ans)
print(ans+1) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import sys
import math
import itertools
from collections import deque
N=200005
inf=(1<<30)
def solve():
s=input()
pos=[]
n=len(s)
pos.append(0)
for i in range(n):
if(s[i]=='R'):
pos.append(i+1)
pos.append(n+1)
ans=0
n=len(pos)
for i in range(1,n):
ans=ma... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | def solve(s):
s = 'R' + s + 'R'
cur = 0
ret = -1
for i, v in enumerate(s):
if v == 'R':
ret = max(ret, i - cur)
cur = i
return ret
def main():
inp = lambda: [int(x) for x in input().split()]
i = lambda: int(input())
tc = i()
for _ in range(tc):
... | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.io.*;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
PrintWriter out = new PrintWr... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | T = int(input())
for _ in range(T):
seq = 'S' + str(input()) + 'F'
longest, c = 0, 0
for i in seq:
if i == 'L':
c += 1
else:
if longest < c:
longest = c
c = 0
print(longest + 1) | PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.util.*;
public class Solution
{
public static void main(String args[])
{
Scanner s= new Scanner(System.in);
int t=s.nextInt();
while(t>0)
{
String str=s.next();
int max=0;
int ans=0;
for(int i=0;i<str.le... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | for _ in range(input()):
a=raw_input()
a="R"+a+"R"
cmax=0
ma=0
for j in range(len(a)):
if a[j]!="L":
ma=max(cmax,ma)
cmax=0
else:
cmax+=1
print ma+1 | PYTHON |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 |
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Cf131 implements Runnable
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private in... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.util.*;
public class frog
{
static int mod = (int) 1e9 + 7;
static int Infinity=Integer.MAX_VALUE;
static int negInfinity=Integer.MIN_VALUE;
public static void main(String args[])
{
try
{
Scanner d= new Scanner(System.in);
int t,i,l,c,j,dd;
... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | import java.io.*;
public class Fields
{
static public void main(String[] args)throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(in.readLine());
while(t-->0)
{
String a=in.readLine();
int n=a.length();
int maxm=1;
int c=1;
for(int... | JAVA |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | t = int(input())
for i in range(t):
l = input().split('R')
lengths = list(map(len, l))
print(max(lengths)+1)
| PYTHON3 |
1324_C. Frog Jumps | There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at the i-th cell and the i-th character is 'L', the frog can jump only to the left. ... | 2 | 9 | t = int(input())
for T in range(t):
s = input()
l = list(s.split('R'))
ans = len(l[0])
for i in l:
ans = max(ans, len(i))
print(ans + 1)
| PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.