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 |
|---|---|---|---|---|---|
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n, m, ans, cnt, a[1005], b[1005];
string s;
int main() {
cin >> s;
s = s + s;
int k = s.size();
cnt = 1;
for (int i = 1; i < k; i++) {
if (s[i] == s[i - 1]) {
ans = max(ans, cnt);
cnt = 1;
continue;
}
cnt++;
}
ans = max(ans, c... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | s = raw_input()
ans, curr = 0, 1
for i in range(1, len(s)):
if s[i-1] != s[i]:
curr += 1
else:
ans = max(ans, curr)
curr = 1
ans = max(ans, curr)
if s[0] != s[-1] and ans < len(s):
st = end = 1
for i in range(1, len(s)):
if s[i] != s[i-1]:
st += 1
... | PYTHON |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | def count(s,t):
count=1
z=0
for i in range(t-1):
if s[i]!=s[i+1]:
count+=1
else:
z=max(z,count)
count=1
z=max(z,count)
return z
s=str(input())
t=len(s)
a=s[::-1]
z=count(s,t)
z... | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXLEN = 100000;
char s[2 * MAXLEN + 1];
int slen;
int dp[2 * MAXLEN];
void run() {
scanf("%s", s);
slen = strlen(s);
for (int i = (0); i < (slen); ++i) s[slen + i] = s[i];
s[2 * slen] = '\0';
... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long int dx[] = {0, 1, -1, 0};
long long int dy[] = {1, 0, 0, -1};
long long int N = (long long int)(2 * 1e5 + 10);
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string s;... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string s;
cin >> s;
s = s + s;
int ans = 1;
int f = 0, e = 0;
for (int i = 1; i < s.size(); i++) {
if (s[i] != s[i - 1]) {
e++;
if (e - f + 1 < s.size() / 2) {
ans ... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
const int maxn = 1e6 + 100;
using namespace std;
int len;
char str[maxn];
int maxx = 0, cnt = 0;
void res() {
for (int i = 1; i <= len; i++) str[i + len] = str[i];
len *= 2;
for (int i = 2; i <= len; i++)
if (str[i] == str[i - 1]) {
maxx = max(maxx, cnt);
cnt = 0;
} el... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #!/usr/bin/python3
def solve(S):
N = len(S)
lens = []
start = 0
for i in range(1, N):
if S[i] == S[i - 1]:
lens.append(i - start)
start = i
lens.append(N - start)
best = max(lens)
if S[0] != S[-1] and len(lens) > 1:
best = max(best, lens[0] + lens[... | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.io.*;
import java.math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;
public class Zebra {
static int mod = 1000000007;
static InputReader in = new InputReader(System.in);
static ... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
int n = s.length();
int count = 1;
if(s.charAt(0)!=s.charAt(n-1)) {
for(int i=0;i<n-1;i++) {
if(s.charAt(i)!=s.charAt(i+1)) {
count++;
}
... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | # your code goes here
# your code goes here
# your code goes here
def lenfinder(ar):
l = 1
for i in range(0,len(ar)-1,1):
if ar[i] == ar[i+1]:
return l
l = l+1
return l
def recur(ar,l):
if ar[0] != ar[len(ar)-1]:
ar = ar[0:l][::-1] + ar[l:][::-1]
return recur(ar,lenfinder(ar))
else:
return a... | PYTHON |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | s=raw_input()
n=len(s)
a=[1]*n
b=[1]*n
for i in range(1,n):
if s[i]!=s[i-1]:
a[i]+=a[i-1]
for i in range(n-2,-1,-1):
if s[i]!=s[i+1]:
b[i]+=b[i+1]
m=max(a)
if s[0]!=s[-1]:
m=max(m,a[-1]+b[0])
print min(m,n) | PYTHON |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;
/**
* ... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 |
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.awt.Point;
public class TryB
{
static class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
public Input... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int modpow(int x, int n) {
if (!n) return 1 % 1000000007;
int u = modpow(x, n / 2);
u = (u * u) % 1000000007;
if (n % 2) u = (u * x) % 1000000007;
return u;
}
int inv(int x) { return modpow(x, 1000000007 - 2); }
vector<long long> prime;
void seive(long long n) {
... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int x = s.length();
s += s;
int n = s.length();
int cnt = 0;
int ans = 0;
for (long long i = 0; i < n - 1; i++) {
if (s[i] == s[i + 1])
ans = max(ans, cnt), cnt = 1;
else
cnt++;
}
ans = max(ans, cnt);
... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n;
string str;
int main() {
cin >> str;
n = str.length();
string str1 = str + str;
reverse(str.begin(), str.end());
string str2 = str + str;
int ans = 0;
int dp[2][2 * n];
for (int i = 0; i < 2 * n - 1; i++) {
dp[0][i] = 1;
if (i > 0 && str1[i] !... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import sys
input = sys.stdin.readline
def gcd(a, b):
if a == 0:
return b
return gcd(b % a, a)
def lcm(a, b):
return (a * b) / gcd(a, b)
def main():
s=input()
st=s[0]
en=s[len(s)-2]
preflen=1
suflen=1
lens=[]
c=1
for i in range(1,len(s)-1):
if s[i]!=s[i-1... | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | def main():
s = input()
a = s[0]
x = r = 0
for b in s:
if a != b:
x += 1
a = b
else:
if r < x:
r = x
x = 1
if x < len(s):
for b in s:
if a != b:
x += 1
a = b
... | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.util.*;
import java.io.*;
import java.lang.*;
public class code1
{
public static int n, m;
public static long[][] cnt;
public static void main(String[] args)
{
InputReader in = new InputReader(System.in);
PrintWriter pw = new PrintWriter(System.out);
//Code starts..
... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | //package aug;
import java.io.*;
import java.util.*;
public class EdRnd49 {
InputStream is;
PrintWriter out;
String INPUT = "";
//boolean codechef=true;
boolean codechef=true;
void solve()
{
//int n=ni();
char[] a=ns().toCharArray();
int n=a.length;
char[] t=new char[2*n];
for(int... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string s;
cin >> s;
long long int ans = 0;
long long int cur = 0;
for (int i = 0; i < s.size(); i++) {
if (i == 0) {
cur++;
ans = max(ans, cur);
} else if (s[i] != s[i - 1]) {
... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string second;
cin >> second;
if (second.length() == 2) {
if (second[0] != second[1]) {
cout << 2 << endl;
return 0;
} else {
cout << 1 << endl;
return 0;
}
}
whi... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const long long inf = 4e18;
const long long maxn = 2e5 + 10;
const long long mod = 1e9 + 7;
string s;
bool mark[maxn];
long long N;
void dfs(long long u) {
mark[u] = 1;
N++;
long long uu = (u - 1 + int((s).size())) % int((s).size());
if (s[uu] != s[u] && !mark[uu]) ... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
void setIO(string name, int submit) {
if (submit) {
ios_base::sync_with_stdio(0);
cin.tie(0);
freopen((name + ".in").c_str(), "r", stdin);
freopen((name + ".out").c_str(), "w", stdout);
} else {
ios_base::sync_with_stdio(0);
cin.tie(0);
}
}
int... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #!/usr/bin/env python3
from sys import stdin, stdout
def rint():
return map(int, stdin.readline().split())
#lines = stdin.readlines()
s = list(input())
n = len(s)
# i : rightmost position of left string
for i in range(0, n-1):
#print(0,i,i+1, n)
#print(s[0:i+1], s[i+1:])
if s[i] == s[i+1] and s[0] !=... | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
public class solutionn {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | s = input()
res = 1
ans = -10000
for i in range(1, len(s)):
if s[i] != s[i - 1]:
res += 1
else:
ans = max(ans, res)
res = 1
ans = max(ans, res)
#print(ans)
res1 = 1
for i in range(1, len(s)):
if s[i] != s[i - 1]:
res1 += 1
else:
break
res2 = 1
for i in range(len(s... | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | s = input()
s = s + s
n, m = 1, 1
for i in range(1, len(s)):
if s[i] != s[i - 1]:
m += 1
n = max(n, m)
else:
m = 1
m, s = 1, s[::-1]
for i in range(1, len(s)):
if s[i] != s[i - 1]:
m += 1
n = max(n, m)
else:
m = 1
print(min(n, len(s) >> 1)) | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
char st[MAXN];
int f[MAXN];
int main() {
scanf("%s", st + 1);
int len = strlen(st + 1), smax = 0;
for (int i = 1; i <= len; i++) st[i + len] = st[i];
for (int i = 1; i <= (len << 1); i++) {
if (st[i] != st[i - 1])
f[i] = f[i - 1] +... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 |
def getAns(s):
l=0
cur = s[0]
temp = 1
for i in range(1,len(s)):
if(cur=='b' and s[i]=='w'):
cur='w'
temp+=1
elif(cur=='w' and s[i]=='b'):
cur='b'
temp+=1
else:
l = max(l,temp)
temp = 1
cur =s[i... | PYTHON |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #yeh dil maange more
s = input()
n = len(s)
if n==1:
print(1)
elif n==2:
if s=='bw' or s=='wb':
print(2)
else:
print(-1)
else:
ans=1
maxans = -1
for i in range(1,n+n+1):
if s[(i-1)%n]=='b' and s[i%n]=='w':
ans+=1
elif s[(i-1)%n]=='w' and s[i%n]=='b':
... | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class ... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
char str[300005];
cin >> str;
int n = strlen(str);
for (int i = 0; i < n; i++) str[i + n] = str[i];
int ans = 1, t = 1;
for (int i = 1; i < 2 * n; i++) {
if (str[i] != str[i - 1])
t++;
else
ans = max(ans, t), t = 1;
}
ans = m... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import sun.rmi.transport.DGCImpl_Stub;
import javax.swing.text.rtf.RTFEditorKit;
import java.io.*;
import java.nio.file.ClosedWatchServiceException;
import java.util.*;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
ConsoleIO io = new ConsoleIO(new InputStreamRea... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | from collections import deque
s2=deque(input())
s4=s2.copy()
s1=deque()
s1.append(s2[0])
s2.popleft()
t=True
while len(s2)>0:
if t:
if s1[-1]!=s2[0]:
s1.append(s2[0])
s2.popleft()
elif s1[0]!=s2[-1]:
t=False
else:
s1+=s2
break
e... | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
const int INF = 1e9 + 7;
const int mod = 1e9 + 7;
string s;
int main() {
cin >> s;
string s2 = s;
s = s + s2;
int l = s.size();
int ans = 1;
int max_1 = 0;
for (int i = 0; i < l - 1; i++) {
if (s[i] != s[i + 1]) {
ans++;
... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
char s[250005];
int main(void) {
int ans = 0, num = 0;
scanf("%s", s + 1);
int len = strlen(s + 1);
for (int i = 1; i <= len; i++) s[len + i] = s[i];
s[0] = s[1];
len = len * 2;
for (int i = 1; i <= len; i++) {
if (s[i] != s[i - 1])
num++;
else
... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int main() {
string str;
while (cin >> str) {
int n = str.size();
str = str + str;
int ans = 0, s = 1;
for (int i = 1; i < str.size(); i++) {
if (str[i] != str[i - 1]) {
s++;
} else {
ans = max(s, ans)... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static int i, j, k, n, m, t, y, x, sum=0;
static long mod = 1000000007;
static FastScanner fs = new FastScanner();
static PrintWriter out = n... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 |
//package cf;
import java.io.*;
import java.util.*;
public class Temp_Class {
static int p=1000000007;
public static void main(String[] args) throws Exception{
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
FastR... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;
public class Main {
static int max = 0;
public static void main(String[] args) throws IOExce... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.io.*;
import java.util.*;
public class Question {
public static int MOD = 1000000007;
static Scan scn = new Scan();
static Print printer = new Print();
public static void main(String[] args) throws Exception {
C();
printer.close();
}
public static void A() throws Exception {
int len = scn.... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
int beingl = 0, endll = 0, maxl = 0, nowl = 0, len = 0;
bool connect = true, duan;
while (cin >> s) {
len = s.size();
nowl = 1;
connect = true;
duan = false;
maxl = 0;
endll = 0;
if (len == 1) {
printf("1\n");... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
char s[100010];
int main() {
int cnt = 1, mmax = 0;
scanf("%s", s);
int len = strlen(s);
for (int j = 0, i = 0; j < 2 * len; i = (++j) % len) {
if (s[i] != s[(i + 1) % len]) {
cnt++;
} else
cnt = 1;
mmax = max(cnt, mmax);
if (cnt == len) ... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
inline void pisz(int n) { printf("%d\n", n); }
const int fx[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
const int fxx[9][2] = {{0, 0}, {0, 1}, {0, -1}, {1, 0}, {-1, 0},
{1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
int main() {
ios_base::sync_with_stdio(0)... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;
import java.text.DecimalFormat;
import java.lang.reflect.Array;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.Big... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
string s;
int ans = 1, cnt = 1;
inline int max(int a, int b) { return a > b ? a : b; }
int main() {
cin >> s;
s += s;
for (int i = 0, len = s.size(); i < len - 1; ++i) {
if (s[i] != s[i + 1]) {
ans = max(ans, cnt);
++cnt;
} else {
ans = max(a... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import sys
range = xrange
b=w=0
switch = 0
S = raw_input()
S += S
prev = 'F'
count = 0
maxcount = 0
for c in S:
if c!=prev:
prev = c
count += 1
else:
count = 1
maxcount = max(maxcount,count)
print min(maxcount,len(S)//2)
#if len(S)==1:
# print 1
# sys.exit()
#
#prev = -1
#fo... | PYTHON |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
;
string s;
cin >> s;
int n = s.size();
int dp[n];
dp[0] = 1;
for (int i = 1; i < n; i++) {
if (s[i] != s[i - 1]) {
dp[i] = dp[i - 1] + 1;
} else {
dp[i] = 1;
}
}
if ... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.io.*;
import java.util.*;
public class C {
private static Reader reader = new Reader();
private static PrintWriter writer = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
String s = reader.readString();
int n = s.length();
int ans = 0;
for (int i = 0; i... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.util.*;
public class MyClass {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
String s=sc.next();
int l=s.length();
int z[]=new int [l];
int max=0;
for(int i=0;i<l;i++)
{
if(i==0)
z[i]=1;
else if(s.... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
string s;
int main() {
cin >> s;
int len = s.length();
int p = len;
for (int i = 0; i < len - 1; i++) {
s.push_back(s[i]);
}
len = s.length();
int ans = 1;
int x = 1;
for (int i = 1; i < len; i++) {
if (s[i] != s[i - 1])
x++;
else
x... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | def main():
s = list(input())*2
ans = 0
k = 1
for i in range(len(s) - 1):
if (s[i] == "b" and s[i + 1] == "b") or (s[i] == "w" and s[i + 1] == "w"):
ans = max(ans, k)
k = 1
else:
k += 1
ans = max(ans, k)
print(min(ans, len(s)//2))
if __name__... | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
string s;
cin >> s;
s += s;
int curr = 1, best = 1;
for (int i = 1; i < s.size(); ++i) {
if (s[i] != s[i - 1]) {
curr++;
best = max(best, curr);
} else
curr = 1;
}
cout << min... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.io.BufferedReader;
import java.util.*;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import java.util.StringTokenizer;
public class A {
public static void main(String[] args) {
FastScanner ... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | s = input()
s += s
n = len(s)
p = [0] * n
p[0] = 1
for i in range(1, n):
if s[i] != s[i - 1]:
p[i] = p[i - 1] + 1
else:
p[i] = 1
print(min(max(p), n // 2)) | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, pos2, res = 1, pos1;
string s;
int main() {
cin >> s;
n = s.length();
s = ' ' + s;
pos2 = n;
for (int i = n - 1; i >= 1; i--)
if (s[i] != s[i + 1])
pos2--;
else
break;
pos1 = 1;
for (int i = 2; i <= n; i++)
... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import jav... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(false);
;
string s;
cin >> s;
int i, n = s.length();
s = s + s;
int l = 1, ans = 1;
for (i = 1; i < 2 * n - 1; i++) {
if (s[i] != s[i - 1]) {
l++;
ans = max(ans, l);
} else {
l = 1;
}
... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import os
import heapq
import sys,threading
import math as mt
import operator
from copy import copy
from collections import defaultdict,deque
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)
#threading.stack_size(2**27)
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b... | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | /////////////package random_practiceQuestions;
import java.util.Scanner;
public class C1025 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s = new Scanner(System.in);
String x = s.nextLine();
int max=0;
int count=0;
for (int i=... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 |
import java.util.Scanner;
public class ReceiveInput {
public static void main(String[]args)
{
Scanner input=new Scanner(System.in);
String a=input.nextLine();
String b=a;
int len=a.length();
int cur=0;
int max=0;
for(int i=0;i<len;i++)
{
if(i==0)
{
... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | //package Contest505;
import java.util.Arrays;
import java.util.Scanner;
public class Main505C {
public static Scanner enter = new Scanner(System.in);
public static void main(String[] args) {
String tmp=enter.next();
int[] mass= new int[tmp.length()+1];
int left=1;
int ku=1;
... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
string S;
cin >> S;
S = S + S;
long long N = S.size();
long long a = 1;
long long res = 1;
for (long long i = 1; i < N; i++) {
if (S[i] != S[i - 1]) {
a++;
... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = int(2e5) + 5;
const int inf = (int)1e9 + 7;
string s;
int main() {
cin >> s;
s = s + s;
int cnt = 1, ans = 0;
for (int i = 1; i < (int)s.size(); ++i) {
if (s[i] != s[i - 1]) {
++cnt;
} else {
ans = max(ans, cnt);
cnt = 1;
... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long const mod = 1000000007LL;
long long const md = 998244353LL;
long long mypowr(long long a, long long b) {
long long res = 1;
if (b < 0) b = 0;
a %= mod;
assert(b >= 0);
for (; b; b >>= 1) {
if (b & 1) res = res * a % mod;
a = a * a % mod;
}
re... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
string st;
int ans, ok, cnt, mx;
int main() {
cin >> st;
ans = st.size();
st += st;
for (int i = 0; i < 2 * ans; i++) {
if (st[i] == st[i - 1])
cnt = 1;
else {
cnt++;
mx = max(mx, cnt);
}
}
ans = min(ans, mx);
cout << ans;
}
| CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int t = 1, ma = 1;
for (int i = 0; i < s.size() - 1; i++) {
if (s[i] != s[i + 1])
t++;
else {
ma = max(ma, t);
t = 1;
}
}
ma = max(ma, t);
if (s[0] != s[s.size() - 1] && ma != s.size()) {
int s... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | a=input()
l=[]
s=len(a)
for i in range(s):
l.append(a[i])
if(l[0]!=l[-1]):
w=l[-1]
for i in range(s-2,-1,-1):
if(l[i]==w):
break
w=l[i]
if(i!=0):
li=[]
v=i
for i in range(v,-1,-1):
li.append(l[i])
for i in range(s-1,v,-1):
... | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
int n;
char s[maxn << 1];
int main(void) {
int i, j;
int ans = 0;
scanf("%s", s);
n = strlen(s);
for (i = 0; i < (n << 1); i++) {
for (j = i; (j + 1 < (n << 1)) && s[(j + 1) % n] != s[j % n]; j++)
;
ans = max(ans, j - i + 1);... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int64_t MOD;
inline void normal(int64_t &a) {
a %= MOD;
(a < 0) && (a += MOD);
}
inline int64_t modMul(int64_t a, int64_t b) {
a %= MOD, b %= MOD;
normal(a), normal(b);
return (a * b) % MOD;
}
inline int64_t modAdd(int64_t a, int64_t b) {
a %= MOD, b %= MOD;
n... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
string s;
int main() {
cin >> s;
s += s;
int ans = 0, len = s.size(), t = 0;
for (int i = 1; i < len; i++) {
if (s[i] == s[i - 1])
t = 1;
else
t++;
ans = max(ans, t);
}
cout << min(ans, len / 2) << endl;
}
| CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | def calc(s):
curr=s[0]
count=1
for i in range(1,len(s)):
if curr==s[i]:
return count
else:
count+=1
curr=s[i]
return count
s=input()
f=calc(s)
b=calc(s[::-1])
c=0
x=s[0]
i=1
l=0
count=1
while i<len(s):
if s[i]!=x:
count+=1
else:
l=max(l,count)
count=1
x=s[i]
i+=1
if f+b<=len(s) and s[0]!... | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
string s;
int main() {
cin >> s;
s += s;
int mx = 1;
int cnt = 1;
for (int i = 1; i < s.length(); i++) {
if (s[i] != s[i - 1]) {
cnt++;
} else {
mx = max(mx, cnt);
cnt = 1;
}
}
mx = max(mx, cnt);
mx = min(mx, (int)(s.length() / ... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const long long maxx = 2 * 1e9 + 7;
bool compare(const pair<long long, long long> &a,
const pair<long long, long long> &b) {
return a.first > b.first;
}
long long inline power(long long a, long long b, long long p) {
a %= p;
long long ans = 1;
while (b ... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const long long INF = 1e18;
const int MAX = 100001;
void solve() {
string str;
cin >> str;
str += str;
long long ans = 0, l = 0;
for (int i = 1; i < (str.length()); i++) {
if (str[i - 1] == str[i]) l = i;
ans = max(ans, i - l + ... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a, b;
bool check(int x) {
for (int i = 1; i < n; ++i) {
if (a[i] % x != 0 && b[i] % x != 0) return false;
}
return true;
}
int main() {
ios_base::sync_with_stdio(false), cin.tie(nullptr);
string s;
cin >> s;
s += s;
int ans = 0, cnt = ... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | s = raw_input()
n = len(s)
l = 1
for i in range(n - 1):
if s[i] == s[i + 1]: break
l += 1
if l == n: print l
else:
l = 1
i = 0
s += s
while i < n:
if s[i] == s[i + 1]:
i += 1
continue
j = i
while s[j] != s[j + 1]: j += 1
if j - i + 1 > l: ... | PYTHON |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | /* Author: Ronak Agarwal, reader part not written by me*/
import java.io.* ; import java.util.* ;
import static java.lang.Math.min ; import static java.lang.Math.max ;
import static java.lang.Math.abs ; import static java.lang.Math.log ;
import static java.lang.Math.pow ; import static java.lang.Math.sqrt ;
/* Thread i... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.util.Scanner;
public class Third {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String z = s.next();
String newZ = z+z;
int ans = 1;
int cur = 1;
for(int i=1;i<newZ.length();i++){
if(newZ.charAt(i) != newZ.charAt(i-1)){
cur++;... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | s = input() * 2
m = 1
n = 1
for i in range(len(s) - 1):
if s[i] != s[i+1]:
n += 1
else:
if n > m:
m = n
n = 1
if n > m:
m = n
print(min(len(s) // 2, m)) | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public ... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | s = str(input())
s_len = len(s)
s = s + s
# print(s)
res = 1
temp = 1
for i in range(len(s) - 1):
if s[i + 1] != s[i]:
res += 1
temp = max(res, temp)
else:
res = 1
print(min(temp, s_len))
| PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.util.*;
public class edu_1025_C
{
public static void main(String[] args)
{
Scanner ob=new Scanner(System.in);
String s=ob.next();
long n=s.length();
char str[]=s.toCharArray();
int len=0;
char p=' ', curr;
long ans=0, f=0, i=0;
while(i ... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
string s, t;
int res;
int fisrt[N], G[N];
int Solve(string s) {
int ans = 1;
int u, v;
int n = s.size();
s = '#' + s;
for (int i = 1; i <= n; i++)
if (s[i] != s[i - 1])
fisrt[i] = fisrt[i - 1] + 1;
else
fisrt[i] = 1;
G[... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
void read(int &x) {
int v = 0, f = 1;
char c = getchar();
while (!isdigit(c) && c != '-') c = getchar();
if (c == '-')
f = -1;
else
v = v * 10 + c - '0';
while (isdigit(c = getchar())) v = v * 10 + c - '0';
x = v * f;
}
void read(long long &x) {
long... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
char s[maxn];
int main() {
while (~scanf(" %s", s)) {
int len = strlen(s);
for (int i = 0; i < len; i++) s[i + len] = s[i];
s[len * 2] = '\0';
int t = 1;
int ans = 0;
for (int i = 0; i < len * 2 - 1; i++) {
if (s[i]... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | r=input()
l=len(r)
ans1=0
prev=r[0]
ans2=1
for i in range(1,l):
if (r[i]!=prev):
ans2=ans2+1
else:
ans1=max(ans1,ans2)
ans2=1
prev=r[i]
ans1=max(ans1,ans2)
ans3=1
prev=r[0]
for i in range(1,l):
if (r[i]==prev):
break
ans3=ans3+1
prev=r[i]
ans4=1
prev=r[-1]
for i in range(l-2,0,-1):
if (r[i]==prev):
bre... | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | s = input()
tot = len(s)
s = s + s
maxVal = 1
currVal = 1
curr = s[0]
for i in range(1, len(s)):
if s[i] == curr:
currVal = 1
else:
currVal += 1
curr = s[i]
if maxVal < currVal:
maxVal = currVal
if maxVal > tot:
maxVal = tot
print(maxVal) | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.io.*;
import java.util.Arrays;
import java.util.StringJoiner;
import java.util.StringTokenizer;
import java.util.function.Function;
public class Main {
static String S;
public static void main(String[] args) {
FastScanner sc = new FastScanner(System.in);
S = sc.next();
Sy... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long int t = 1, i = 0, j = 0, k = 1;
while (t--) {
string s;
cin >> s;
long long int len = s.length();
long long int b = 1, a = 1;
for (i = len - 1; i > 0; --i) {
if (s... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | // @jagrit_07
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();
char ch[] = sc.next().toCharArray();
if(ch.length==1)
{
System.out.println(1);
... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
char s[100005];
int main() {
scanf("%s", s);
int n = strlen(s);
for (int i = 0; i < n - 1; i++) {
if (s[i] != s[i + 1]) {
continue;
}
if (s[0] == s[n - 1]) {
continue;
}
reverse(s, s + i + 1);
reverse(s + i + 1, s + n);
}
int an... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | s=input()
c=s[0]
cnt=1
ma=1
for i in range(1,len(s)):
if s[i]!=c:
cnt+=1
c=s[i]
else:
ma=max(ma,cnt)
cnt=1
c=s[i]
ma=max(ma,cnt)
if s[0]==s[-1] or len(s)<=2:
print(ma)
else:
cnt=1
c=s[0]
for i in range(1,len(s)):
if s[i]!=c:
cnt+=1
... | PYTHON3 |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long dp[200005];
void solve() {
string s;
cin >> s;
long long n = s.length();
long long ans = 0, val1 = 1;
dp[0] = 1;
for (long long i = 1; s[i]; i++) {
if (s[i] != s[i - 1])
dp[i] = dp[i - 1] + 1;
else
dp[i] = 1;
val1 = max(val1, dp... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;
public class Solution_505_3 {
public static void main(String[] args) throws Exception {
InputReader in = new InputReader(System.in);
String st =in.readString();
boolean arr[] = new boolean[st.l... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int INF = 2147000000;
const long long inf = 1e19;
string s;
int a, b, c, d, e;
int sum, ans;
int main() {
cin >> s;
s += s;
int n = s.length();
for (int i = 0; i < n - 1; i++) {
if (s[i] != s[i + 1]) {
sum++;
if (ans < sum + 1) {
ans = ... | CPP |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 |
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.Collections;
import java.io.InputStreamReader;
public class Main1 {
static boolean vis[];
static int cnt = 0;
static StringBuilder sb;
public static void m... | JAVA |
1025_C. Plasticine zebra | Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now ... | 2 | 9 | s = input()
ans = 0
i, j = 0, 1
while i < len(s):
while j < len(s) and s[j] != s[j - 1]:
j += 1
ans = max(j - i, ans)
i, j = j, j + 1
if s[0] != s[-1]:
j = 0
while j < len(s) and s[j] != s[j - 1]:
j += 1
if j < len(s):
i = len(s) - 2
while i >= 0 and s[i] != s[i +... | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.