prompt
string
response
string
Problem: 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 t...
for _ in range(int(input())): # r,g,b=map(int,input().split()) # rl=list(map(int,input().split())) # gl=list(map(int,input().split())) # bl=list(map(int,input().split())) # rl.sort() # gl.sort() # bl.sort() s=input() n=len(s) l=0 ml=0 for i in range(n): if s[i]==...
Problem: 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 t...
import java.util.*; import java.lang.Math; import java.util.Arrays; import java.util.Scanner; import java.util.stream.IntStream; import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; pu...
Problem: 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 t...
t = int(input()) for j in range(t): s = input() count = 0 max_l = [] for i in range(len(s)): if s[i]=="L": count+=1 else: max_l.append(count) count =0 max_l.append(count) if max(max_l) == 0: print(1) else: print(max(max...
Problem: 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 t...
t=int(input()) for _ in range(t): s=input() n=len(s) i=0 m=0 k=0 while i<n: if s[i]=='L': m=m+1 k=max(m,k) else: m=0 k=max(m,k) i=i+1 print(k+1)
Problem: 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 t...
from bisect import bisect_left as bl, bisect_right as br, insort import sys import heapq from collections import defaultdict as dd, deque def data(): return sys.stdin.readline().strip() def mdata(): return map(int, data().split()) # sys.setrecursionlimit(100000) def conv(x): return bin(x).replace("0b", "") ...
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string S; cin >> S; int size = S.size(); int maxm = 0, cnt = 0, i; for (i = 0; i < size; i++) { if (S[i] == 'L') cnt++; else { maxm = max(maxm, cnt); cnt = 0; } ...
Problem: 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 t...
t=int(input()) for you in range(t): l=input() li=[0] for i in range(len(l)): if(l[i]=='R'): li.append(i+1) li.append(len(l)+1) lo=[] for i in range(len(li)-1): lo.append(li[i+1]-li[i]) print(max(lo))
Problem: 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 t...
def solve(): string = input() minimum = 0 skip = string.split('R') for s in skip: if len(s) + 1 > minimum: minimum = len(s) + 1 print(minimum) for _ in range(int(input())): solve()
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const double PI = acos(-1.0); const int INF = 0x3f3f3f3f; const int SZ = 2e5 + 10; int n; char s[SZ]; int main() { int T; scanf("%d", &T); while (T--) { scanf("%s", s + 1); int len = strlen(s + 1); s[0] = 'R'; s[len + 1] = 'R';...
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { string s; long long int n, i, count_L = 0, mx = 0; cin >> s; for (i = 0; i < s.size(); i++) { if (s[i] == 'L') { count_L++; mx = max(count_L, mx); } if (s[i] == 'R'...
Problem: 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 t...
for _ in range(int(input())): s=input() n = 0 c=0 f=0 for i in range(len(s)): if s[i]=='L' and f==0: f=1 c=1 elif s[i]=='L' and f==1: c+=1 else: f=0 if c>n: n=c if c>n: n=c print(n+1)
Problem: 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 t...
t=int(input()) for _ in range (t): s = input() n=len(s) mx=1 curr=1 for i in range (n): if(s[i] == 'R'): curr=1 else: curr+=1 mx=max(mx,curr) print(mx)
Problem: 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 t...
for _ in range(int(input())): a = input() n = len(a) i=0 c = 0 while i<n: if a[i]=='L': j=i temp = 1 while j<n-1: if a[j+1]=='L': temp+=1 j+=1 else: break ...
Problem: 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 t...
t = int(input()) for _ in range(t): s = input() n = len(s) l = [] prev = s.find("R") if (prev == -1): print(n+1) else: l.append(prev+1) start = prev for i in range(start,n): if s[i]=="R": l.append(i-prev) prev = i l.append(n-prev) print(max(l))
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; void solve() { string s; cin >> s; int last_seen = -1; int result = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == 'R') { result = max(result, i - last_seen); last_seen = i; } } result = max(result, (int)s.size() - last_seen); cout <...
Problem: 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 t...
for _ in range(int(input())): s=input() n=len(s) i=0 f=0 while(i<n+1): if(i==n): m=n+1 f=1 break elif(s[i]=='R'): m=i+1 j=i f=1 break i+=1 i+=1 while(i<n+1): if(i==n): ...
Problem: 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 t...
# lets find longest lenght of L consequtive def length(string): maxl=0 l=0 for ele in string: if(ele=='R'): # Now reset l=0 and check if it is max l=0 else: l+=1 maxl=max(l,maxl) print(maxl+1) t=int(input()) stringarr=[None for i in range(t)] # input for i in range(t): stringarr[i]=input()...
Problem: 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 t...
from collections import defaultdict IA = lambda: map(int,input().split()) T=int(input()) for i in range(0,T): n=input() le=len(n) l=int(0) pre=0 i=0 ans=0 for it in n: i+=1 if it=='R': ans=max(ans,i-pre) pre=i ans=max(ans,le+1-...
Problem: 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 t...
for _ in range(int(input())): s=input() c=0 ans=0 f=0 for x in s: if(x=='L'): if(f==0): c=1 f=1 else: c+=1 else: f=0 ans=max(ans,c) c=0 if(c!...
Problem: 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 t...
for i in range(int(input())): avl = input() li = [0] n = len(avl) for j in range(n): if avl[j] == "R": li.append(j+1) li.append(n+1) nn = len(li) ans = 0 for j in range(nn-1): ans = max((li[j+1] - li[j]), ans) print(ans)
Problem: 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 t...
t=int(input()) for _ in range(t): s=input() n=len(s) j=0 dif=0 for i in range(n): if s[i]=="R": j=i+1-j dif=max(dif,j) j=i+1 dif=max(dif,n+1-j) print(dif) #6 #LRLRRLL #L #LLR #RRRR #LLLLLL #R
Problem: 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 t...
def possible(s): max_=0 val=-1 for i in range(len(s)): if s[i]=='R': max_=max(max_,(i-val)) val=i max_=max(max_,(len(s)-val)) return max_ for _ in range(int(input())): s=input() print(possible(s))
Problem: 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 t...
import sys for i in range(int(input())): s=input() last=0 first=sys.maxsize m=-sys.maxsize n=len(s) if s=='L'*n: print(n+1) elif s=='R'*n: print(1) else: for i in range(n): if s[i]=="R": first=min(i,first) m=max(m,i-last...
Problem: 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 t...
t=int(input()) for _ in range(t): s=list(input()) ma=0 count=0 for i in s: if(i=="L"): count+=1 else: if(count>ma): ma=count count=0 if(count>ma): ma=count print(ma+1)
Problem: 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 t...
t=int(input()) while(t!=0): s=list(input()) Rs = [] m = 0 if('R' in s): for i in range(len(s)): if(s[i]=='R'): Rs.append(i) for i in range(1, len(Rs)): m = max(m, Rs[i]-Rs[i-1]) m = max(Rs[0]+1, m, len(s)-Rs[-1]) else: m = len(s...
Problem: 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 t...
from math import inf def main(): a = list(input()) arr = [] maxx = 0 maxxx = 0 for i in range(len(a)): if a[i] == 'L': maxx += 1 elif a[i] == 'R': maxxx = max(maxx, maxxx) maxx = 0 maxxx = max(maxx, maxxx) print(maxxx+1) if __name__ == "__main__": for _ in range(int...
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s; cin >> s; int count, j = 0, max = 0; for (int i = 0; i < s.length() - 1; i++) { if (s[i] == 'L') { count = 1; while (s[i + 1] == 'L') { count++; i++; ...
Problem: 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 t...
import bisect import os import gc import sys from io import BytesIO, IOBase from collections import Counter from collections import deque import heapq import math import statistics def sin(): return input() def ain(): return list(map(int, sin().split())) def sain(): return input().split() def iin(): ...
Problem: 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 t...
import sys #sys.stdin = open("input.txt") T = int(input()) t = 0 while t<T: L = input() conta = 0 out = 0 for c in L: if c == "R": if conta > out: out = conta conta = 0 else: conta +=1 #print (c,out, conta) if conta>out: ...
Problem: 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 t...
import java.util.*; import java.util.regex.*; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.io.*; public class C627 { static int get(String s) { return Integer.parseInt(s); } static int max(int a,int b) { return a>b?a:b; } public stat...
Problem: 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 t...
T=input() for p in xrange(T): s='R' s+=raw_input() s+='R' l=0 d=0 for i in xrange(len(s)): if s[i]=='R': d=max(d, i-l) l=i print d
Problem: 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 t...
def main(): t = int(input()) for __ in range(t): s = input() n = len(s) r = [] found = False for i in range(n): if s[i] == "R": r.append(i+1) found = True if found: d = r[0] j = r[0] m...
Problem: 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 t...
t=int(input()) for l in range(t): a=input() i=1 num=[] c=0 for k in a: if k=="R": num.append(i-c) c=i i+=1 num.append(i-c) print(max(num))
Problem: 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 t...
import java.util.*; public class C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); while (T-->0) { String s = sc.next(); SortedSet<Integer> set = new TreeSet<>(); for(int i = 0 ; i < s.length(...
Problem: 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 t...
for i in range(int(input())): s = input() s += 'R' ss = [-1] ans = [] for j in range(len(s)): if s[j] == 'R': ans.append(j - ss[-1]) ss.append(j) print(max(ans))
Problem: 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 t...
import sys input = sys.stdin.readline t = int(input()) for _ in range(t): s = input().strip() flag = False biggest = 0 count = 0 for i in s: if i == "L": count += 1 else: if count > biggest: biggest = count count = 0 ...
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long i, j, k, l, m, n, cnt = 0, ma = 0; string str; cin >> str; l = str.length(); for (i = 0; i < l; i++) { if (str[i] == 'L') { while (str[i] == 'L' && i < l) { cnt++; ...
Problem: 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 t...
for _ in range(int(input())): s=input() prev=-1 ans=0 for i in range(len(s)): if s[i]=='R': ans=max(ans,i-prev) prev=i ans=max(ans,len(s)-prev) print(ans)
Problem: 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 t...
import math t = int(input()) ans = [] for i in range(t): k = 0 d = 1 s = str(input()) for j in range(len(s)): if s[j] == "L": k += 1 else: if k != 0: d = max(k+1, d) k = 0 if k != 0: d = max(k+1, d) ans.append(d) fo...
Problem: 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 t...
n_tests = int(input()) for _ in range(n_tests): str = input() prev = -1 maxx = 0 for i in range(len(str)): if str[i] == 'R': tmp = i - prev prev = i if tmp > maxx: maxx = tmp if len(str)-prev > maxx: maxx = len(str)-prev print(m...
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; for (int i = 0; i < t; i++) { int maxdlu = 0; int dlu = 0; string s; cin >> s; for (int j = 0; j < s.size(); j++) { if (s[j] == 'L') { dlu = 0; ...
Problem: 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 t...
for _ in range(int(input())): s = input() max_l_len = 0 l_len = 0 for c in s: if c == 'L': l_len += 1 else: max_l_len = max(max_l_len, l_len) l_len = 0 max_l_len = max(max_l_len, l_len) print(max_l_len + 1)
Problem: 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 t...
t = int(input()) for _ in range(t): s = input() mx = 0 curr = 0 for i in range(len(s)): if s[i]=='R': mx = max(mx, curr) curr = 0 else: curr += 1 mx = max(mx, curr) print(mx+1)
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s; cin >> s; int r1 = -1; int ans = 0; int l = s.size(); for (int i = 0; i < l; ++i) { if (s[i] == 'R') { if (i - r1 > ans) ans = i - r1; r1 = i; } } if (l -...
Problem: 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 t...
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class FlogJumps { public static void main(String[]arg) { Scanner myReader = new Scanner(System.in); String loops = myReader.nextLine(); int loop = Integer.parseInt(loops); for(int i =0;i<loop;i++) { String line = myReader.n...
Problem: 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 t...
T= int(input()) for t in range(T): s=input() s+='R' c=1 ans=0 for i in s: if i=='R': ans=max(ans,c) c=1 else: c+=1 print(ans)
Problem: 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 t...
#matha noshto kore dise for _ in range(int(input())): s = input().split('R') d=0 for i in s: d=max(len(i),d) print(d+1)
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s; cin >> s; int dist = 0, flag = 0, ldist = 0, counter = 0; int n = s.length(); for (int i = 0; i < n; i++) { if (s[i] == 'R') { dist = max(dist, i + 1); flag = 1; br...
Problem: 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 t...
for _ in range (int(input())): s = input() n = len(s) l = [0] for i in range (n): if s[i] == "R": l.append(i + 1) l.append(n + 1) m = 0 for i in range (1, len(l)): m = max(m, l[i] - l[i - 1]) print(m)
Problem: 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 t...
def read_test(): return raw_input() def solve(s): m = 0 c = 0 for si in s: if si == "R": m = max(m, c) c = 0 else: c += 1 m = max(m, c) return m + 1 n = int(raw_input()) for i in range(n): res = solve(read_test()) print(res)
Problem: 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 t...
import sys input = sys.stdin.readline def getInt(): return int(input()) def getVars(): return map(int, input().split()) def getList(): return list(map(int, input().split())) def getStr(): return input().strip() ## ------------------------------- t = getInt() for _ in range(t): s = getStr() s += 'R' res = 0...
Problem: 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 t...
n = int(input()) for i in range(n): s = 'R' + input() + 'R' ind = 0 mi = 1 for i in range(1,len(s)): if s[i] == 'R': if i - ind > mi: mi = i - ind ind = i print(mi)
Problem: 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 t...
for _ in range(int(input())): s=map(len,input().split('R')) print(max(s)+1)
Problem: 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 t...
t = int(input()) for _ in range(t): string = 'R' + str(input()) + 'R' l = len(string) before = 0 ret = 0 for i in range(0, l): if string[i] == 'R': ret = max(ret, i - before) before = i print(ret)
Problem: 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 t...
for _ in range(int(input())): s = input() prev = -1 d = 0 n = len(s) for i in range(n): if s[i] == 'R': d = max(d, i-prev) prev = i if d == 0: print(n+1) else: d = max(d, n-prev) print(d)
Problem: 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 t...
for i in range(int(input())): s='R' + input() + 'R' prev=0 ma=-1 for i in range(1,len(s)): if s[i]=='R': ma=max(ma,i-prev) prev=i print(ma)
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int t; cin >> t; while (t--) { string line; cin >> line; int n = line.size(); int ret = 0; int last = -1; for (int i = 0; i < n; i++) { if (line[i] == 'R') { ret = max(ret, i - last); las...
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; int a[200005]; int main() { int test; scanf("%d", &(test)); for (int t = 1; t <= test; t++) { int cnt = 0; a[cnt++] = -1; string s; cin >> s; int n = s.size(); for (int i = 0; i < n; i++) { if (s[i] == 'R') a[cnt++] = i; } a[cnt++...
Problem: 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 t...
t=int(input()) for i in range(t): s=input() x=[0] for j in range(len(s)): if s[j]=="R": x.append(j+1) x.append(len(s)+1) x1=[] for j in range(1,len(x)): x1.append(x[j]-x[j-1]) x1.sort() print(x1[len(x1)-1])
Problem: 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 t...
for t in range(int(input())): arr = input() arr = 'R' + arr n = len(arr) d = 0 i = n while i>=0: i -= 1 steps = 0 while arr[i]!='R': i -= 1 steps += 1 if steps > d: d = steps print(d+1)
Problem: 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 t...
def rec(s): steps = 1 l = [] for i in s: if i == "L": steps += 1 else: l.append(steps) steps = 1 l.append(steps) return max(l) t = int(input()) for _ in range(t): s = input() print(rec(s))
Problem: 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 t...
for i in range(int(input())): s=input() c=0 mx=0 for j in range(len(s)): if s[j]=='L': c=c+1 else: c=0 if c>mx: mx=c print(mx+1);
Problem: 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 t...
import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { FastReader sc =new FastReader(); int t=sc.nextInt(); // int t=1; while(t-->0) { char arr[] = sc.next().toCharArray(); ...
Problem: 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 t...
t = int(input()) for p in range(t): s = input() maxi = 0 x = 0 for item in s: if item == "L": x += 1 if x >maxi: maxi = x else: x = 0 print(maxi+1)
Problem: 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 t...
for _ in range(int(input())): s = input() n = len(s) L = [0] #for x in range(2, n+1): #temp = s[:-(x-1)] for x in range(n): if s[x] == "R": L.append(0) else: L[-1] += 1 print(max(L)+1)
Problem: 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 t...
t = int(input()) def find_greater_distance(way): i = -1 distance = 0 for j in range(len(way)): if way[j] == 'R': if j - i > distance: distance = j - i i = j return len(way) - i if len(way) - i > distance else distance for _ in range(t): s = input() ...
Problem: 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 t...
import sys def solve(): input = sys.stdin.readline T = int(input()) for _ in range(T): S = input().strip("\n") S += "R" maxL = 0 start = False count = 0 for i in range(len(S)): if S[i] == "L": if start: count += 1 e...
Problem: 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 t...
import java.util.*; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.util.Scanner; import...
Problem: 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 t...
t=int(input()) for i in range(t): s=input() s=list(s) s.insert(0,0) s.append(0) jumps=[] start=0 for i in range(len(s)): if s[i]=='R': jumps.append(i-start) start=i jumps.append(len(s)-1-start) print(max(jumps))
Problem: 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 t...
t=int(input()) for i in range(1,t+1,1): s=input().split('R') #print(s) #print(max(s)) print(len(max(s))+1)
Problem: 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 t...
''' =============================== -- @uthor : Kaleab Asfaw -- Handle : kaleabasfaw2010 -- Bio : High-School Student ===============================''' # Fast IO import sys import os from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): s...
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int T; cin >> T; for (int t = 0; t < T; ++t) { string s; cin >> s; s += 'R'; int loc = -1, ans = 0; for (int i = 0; i < s.length(); ++i) { if (s[i] == 'R') { ans = max(ans...
Problem: 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 t...
t = int(input()) for i in range(t): s = input() s = "R" + s + "R" ans = 0 seq = False x = 0 j = 0 while j < len(s) : if ( s[j] == 'L' ) : if seq == True : x += 1 else : seq = True x = 1 else : ...
Problem: 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 t...
N = int(input()) for _ in range(N): s = input() ln = 1 now = s[0] ans = [] for i in range(1, len(s)): if s[i] == now: ln += 1 else: ans.append((now, ln)) ln = 1 now = s[i] ans.append((now, ln)) # print(*ans) mx = 0 for d...
Problem: 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 t...
for _ in range(int(input())): arr = input() maks = 0 temp = 1 if arr[0] == 'L' else 0 for i in range(1, len(arr)): if arr[i] == 'L' and arr[i - 1] == arr[i]: temp += 1 else: maks = max(maks, temp) temp = 1 if arr[i] == 'L' else 0 maks = max(maks, ...
Problem: 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 t...
t = int(input()) for _ in range(t): s = input() n = len(s) count = [] temp = 1 flag = 0 for i in range(n-1): if s[i] == s[i+1] and s[i] == "L": flag = 1 temp += 1 else: if flag: count.append(temp) temp = 1 ...
Problem: 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 t...
def solve(): s = input() prev, ans = -1, 0 for i in range(len(s)): if s[i] == 'R': ans = max(ans, i - prev) prev = i ans = max(ans, len(s) - prev) print(ans) t = int(input()) for _ in range(t): solve()
Problem: 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 t...
t = int(input()) for rep in range(t): s = input() maxi = 0 count = 0 for i in range(len(s)): if s[i] == "L": count += 1 else: if count > maxi: maxi = count count = 0 if count > maxi: maxi = count print(maxi+1)
Problem: 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 t...
import java.util.*; public class Q1 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scn=new Scanner(System.in); int t=scn.nextInt(); for(int q=1;q<=t;q++) { String str=scn.next(); String str2="R"+str; int prev=0; ArrayList<Integer> list=new Ar...
Problem: 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 t...
n=int(input()) for _ in range(n): s='R'+input()+'R' mx=-1 t=0 flag=0 for i in range(len(s)): if s[i]=='R': mx=max(mx,t) flag=1 t=1 else: t+=1 flag=0 if flag==0: mx=max(mx,t) print(mx)
Problem: 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 t...
t=int(input()) for t1 in range(0,t): s1=input() n=len(s1) f=0 flag=-1 ok=0 for i in range(0,n): if s1[i]=="L": f=f+1 ok=0 else: flag=max(flag,f) f=0 ok=1 if ok==0: flag=max(flag,f) if flag==-1: print(n+1) else: print(flag+1)
Problem: 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 t...
# frog_jumps.py t = int(input()) while t>0: t-=1 s = input() count = 0 ans = 0 for i in range(len(s)): if s[i] == 'L': count+=1 elif s[i] == 'R': ans = max(ans,count) count = 0 # print(count,ans) ans = max(ans,count) print(ans+1)
Problem: 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 t...
t = int(input()) for i in range(t): s = input() l = [-1,] for i in range(len(s)): if s[i]=='R': l.append(i) l.append(len(s)) for i in range(len(l)-1,0,-1): l[i]-=l[i-1] print(max(l[1:]))
Problem: 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 t...
def find_d(s): s = 'R' + s + 'R' _max_ = 1 counter = 1 for symbol in s: if symbol=='R': if _max_<counter: _max_ = counter counter = 1 else: counter+=1 print(_max_) n = int(input()) for _ in range(n): s = input() find_d(s)
Problem: 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 t...
for _ in range(int(input())): s = input() r = [0] for i in range(len(s)): if s[i] == 'R': r.append(i + 1) r.append(len(s) + 1) d = 0 for i in range(len(r) - 1): d = max(d, r[i+1] - r[i]) print(d)
Problem: 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 t...
# import sys # file = open("test1") # sys.stdin = file def ii(): return int(input()) def ai(): return list(map(int, input().split())) def mi(): return map(int, input().split()) for _ in range(ii()): path = list(input()) arr = [0 for i in range(len(path)+1)] max_con_seq = 0 temp = 0 cont = False for ele in path:...
Problem: 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 t...
for _ in range(int(input())): X = input() Max = 0 Count = 0 for i in X: if i == "L": Count += 1 Max = max(Max, Count) else: Count = 0 print(Max+1)
Problem: 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 t...
import sys t = int(sys.stdin.readline()) for _ in range(t): s = sys.stdin.readline().split()[0] s = 'R' + s + 'R' prev = 0 maxi = 0 acc = 0 for i in range(len(s)): if s[i] == 'R': maxi = max(maxi, acc) acc = 0 else: acc += 1 print(maxi + ...
Problem: 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 t...
t = int(input()) while t!=0: s = input() right = [0] for i in range(len(s)): if s[i] == 'R': right.append(i+1) right.append(len(s)+1) maxi = 0 for i in range(len(right)-1): maxi = max(maxi,right[i+1]-right[i]) print(maxi) t-=1
Problem: 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 t...
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.StringTokenizer; public class Main { ...
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s; cin >> s; int cnt = 0, mx = 0; for (int i = 0; i < s.length(); i++) { if (s[i] == 'L') { cnt++; mx = max(cnt, mx); } else cnt = 0; } cout << mx + 1 << '\n...
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; long long qw; string s; int main() { cin >> qw; for (long long i = 0; i < qw; i++) { cin >> s; long long ans = 1; long long cnt = 0; for (long long i = 0; i < s.size(); i++) { if (s[i] == 'L') { cnt++; } else { ans = max(ans, ...
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; long long max(int a, int b) { if (a > b) { return a; } else { return b; } } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n; cin >> n; string str; while (n--) { cin >> str; long long k = str.length(); vector...
Problem: 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 t...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2020/3/12 22:30 @Author : Yuki @File : C.py @Software: PyCharm @E-main : fujii20180311@foxmail.com """ n = int(input()) for i in range(n): path = input() rpos = [] for k in range(len(path)): if path[k]=='R': rpos.append(k+...
Problem: 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 t...
#include <bits/stdc++.h> using namespace std; int main() { int test; cin >> test; while (test--) { int ans = -1; string s; cin >> s; for (int i = 0; i < int((s).size());) { if (s[i] == 'L') { int cnt = 0; int j = i; while (s[j] == 'L' && j < int((s).size())) { ...
Problem: 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 t...
T = int(input()) for i in range(T): S= str(input()) L = -1; stat = 0; minI = 1000000; Len = len(S) Dist = [] for i in range(Len): if (S[i]=="R"): Dist.append(i-L) L=i stat = 1; Dist.append(Len-L) if stat==0: print(Len +...
Problem: 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 t...
n = int(input()) for _ in range(n): s = 'R' + str(input()) + 'R' max_c = 1 last_r = 0 for i in range(len(s)): if s[i] == 'R': if i - last_r > max_c: max_c = i - last_r last_r = i print(max_c)
Problem: 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 t...
######### ## ## ## #### ##### ## # ## # ## # # # # # # # # # # # # # # # # # # # # # # # ### # # # # # # # # # # # # # ##### # # # # ### # # # # # # # # ##### # # # # # # # # # # # # # # # # # # #########...
Problem: 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 t...
for _ in range(int(input())): s = input() max_len = 0 cnt = 0 for i in range(len(s)): if s[i]=='L': cnt += 1 elif s[i]=='R': if cnt>max_len: max_len = cnt cnt = 0 if i=...
Problem: 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 t...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author KharYusuf */ public class ...