message stringlengths 2 23.8k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 97 109k | cluster float64 0 0 | __index_level_0__ int64 194 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.
More formally, you are given two strings s1, s2 of length n and num... | instruction | 0 | 7,949 | 0 | 15,898 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
n, t = map(int, input().split())
a, b = input(), input()
ans = []
s = d = 0
for i, j in zip(a, b):
if i == j:
s += 1
else:
d += 1
if t < (d + 1) // 2:
print(-1)
exit()
x = min(n - t, s)
y = z = max(n - t - s, 0)
def f(a, b):
for i in ran... | output | 1 | 7,949 | 0 | 15,899 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.
More formally, you are given two strings s1, s2 of length n and num... | instruction | 0 | 7,950 | 0 | 15,900 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
n, t = map(int, input().split())
s1 = str(input())
s2 = str(input())
s1cnt, s2cnt = n - t, n - t
ans = [None] * n
# print(s1cnt, s2cnt)
for i in range(n):
ch1, ch2 = s1[i], s2[i]
if ch1 == ch2 and s1cnt and s2cnt:
ans[i] = ch1
... | output | 1 | 7,950 | 0 | 15,901 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.
More formally, you are given two strings s1, s2 of length n and num... | instruction | 0 | 7,951 | 0 | 15,902 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
def get_diff(a,b):
res='a'
while res==a or res==b:
res=chr(ord(res)+1)
return res
n,t=map(int, input().split())
s1=input()
s2=input()
diff=0
res="-1"
for i in range(n):
if s1[i]!=s2[i]:
diff+=1
if t<diff:
if t*2>=diff:
res=[None]*n
singo... | output | 1 | 7,951 | 0 | 15,903 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.
More formally, you are given two strings s1, s2 of length n and num... | instruction | 0 | 7,952 | 0 | 15,904 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
import sys
letras="abcdefghijklmnopqrstuvwxyz"
def distinto(a,b):
for lc in range(26):
c=letras[lc]
if (a!=c and b!= c): return c
s3=""
l=0
for line in sys.stdin:
if l==0:
n,t=map(int,line.split())
if l==1:
s1=line
else: s2=line
l+=1
... | output | 1 | 7,952 | 0 | 15,905 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.
More formally, you a... | instruction | 0 | 7,953 | 0 | 15,906 |
Yes | output | 1 | 7,953 | 0 | 15,907 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.
More formally, you a... | instruction | 0 | 7,954 | 0 | 15,908 |
Yes | output | 1 | 7,954 | 0 | 15,909 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.
More formally, you a... | instruction | 0 | 7,955 | 0 | 15,910 |
Yes | output | 1 | 7,955 | 0 | 15,911 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.
More formally, you a... | instruction | 0 | 7,956 | 0 | 15,912 |
Yes | output | 1 | 7,956 | 0 | 15,913 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.
More formally, you a... | instruction | 0 | 7,958 | 0 | 15,916 |
No | output | 1 | 7,958 | 0 | 15,917 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.
More formally, you a... | instruction | 0 | 7,959 | 0 | 15,918 |
No | output | 1 | 7,959 | 0 | 15,919 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.
More formally, you a... | instruction | 0 | 7,960 | 0 | 15,920 |
No | output | 1 | 7,960 | 0 | 15,921 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Toad Rash has a binary string s. A binary string consists only of zeros and ones.
Let n be the length of s.
Rash needs to find the number of such pairs of integers l, r that 1 β€ l β€ r β€ n and there is at least one pair of integers x, k suc... | instruction | 0 | 8,426 | 0 | 16,852 |
Tags: brute force, two pointers
Correct Solution:
```
s = input()
cur, ans = - 1, 0
for i in range(len(s)):
for j in range(cur + 1, i - 1):
if (i + j) % 2 == 0 and s[i] == s[j] and s[i] == s[(i + j) // 2]:
cur = j
ans += cur + 1
print(ans)
``` | output | 1 | 8,426 | 0 | 16,853 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can reverse any substring of s. A substring of a st... | instruction | 0 | 8,546 | 0 | 17,092 |
Tags: constructive algorithms, greedy
Correct Solution:
```
from math import ceil
for _ in range(int(input())):
n = int(input())
s = input()
ct = 0
for i in range(n-1):
if s[i] == s[i+1]:
ct += 1
print(ceil(ct / 2.0))
``` | output | 1 | 8,546 | 0 | 17,093 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can reverse any substring of s. A substring of a st... | instruction | 0 | 8,547 | 0 | 17,094 |
Tags: constructive algorithms, greedy
Correct Solution:
```
t=int(input())
for i in range(0, t):
n=int(input())
s=input()
count=0
for j in range(0,n):
if(j!=(n-1)):
if(s[j]==s[j+1]):
count=count+1
else:
if(s[j]==s[0]):
count=count+... | output | 1 | 8,547 | 0 | 17,095 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can reverse any substring of s. A substring of a st... | instruction | 0 | 8,548 | 0 | 17,096 |
Tags: constructive algorithms, greedy
Correct Solution:
```
import sys
import math
from collections import Counter,defaultdict
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
def case():
n=IN()
s=S()
a=s.split("0")
b=s.split("1")
... | output | 1 | 8,548 | 0 | 17,097 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can reverse any substring of s. A substring of a st... | instruction | 0 | 8,549 | 0 | 17,098 |
Tags: constructive algorithms, greedy
Correct Solution:
```
for _ in range(int(input())):
n=int(input())
s=list(input())
maxi=0
temp1=0
temp2=0
for i in range(1,n):
if(s[i-1]=='1' and s[i]=='1'):
temp1+=1
maxi=max(maxi,temp1)
if(s[i-1]=='0' and s[i]=='0'):
temp2+=1
maxi=max(maxi,temp2)
print... | output | 1 | 8,549 | 0 | 17,099 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can reverse any substring of s. A substring of a st... | instruction | 0 | 8,550 | 0 | 17,100 |
Tags: constructive algorithms, greedy
Correct Solution:
```
t = int(input())
while t > 0:
t -= 1
n = int(input())
s = input()
ans = 0
i = 0
while i+1 < n:
if s[i] == s[i+1]:
ans += 1;
i += 1
print((ans+1)//2)
``` | output | 1 | 8,550 | 0 | 17,101 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can reverse any substring of s. A substring of a st... | instruction | 0 | 8,551 | 0 | 17,102 |
Tags: constructive algorithms, greedy
Correct Solution:
```
t=int(input())
for i in range(t):
n=int(input())
s=input()
c=0
for i in range(0,n-1):
if s[i]==s[i+1]:
c+=1
print((c+1)//2)
``` | output | 1 | 8,551 | 0 | 17,103 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can reverse any substring of s. A substring of a st... | instruction | 0 | 8,552 | 0 | 17,104 |
Tags: constructive algorithms, greedy
Correct Solution:
```
"""
pppppppppppppppppppp
ppppp ppppppppppppppppppp
ppppppp ppppppppppppppppppppp
pppppppp pppppppppppppppppppppp
ppppppppppppppppppppppp... | output | 1 | 8,552 | 0 | 17,105 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can reverse any substring of s. A substring of a st... | instruction | 0 | 8,553 | 0 | 17,106 |
Tags: constructive algorithms, greedy
Correct Solution:
```
import math
t=int(input())
for _ in range(t):
n=int(input())
s=str(input())
v1=0;v2=0
p=0
for i in range(len(s)):
if int(s[i])!=i%2:
p+=1
else:
v1+=int(p>0)
p=0
v1+=int(p>0)
p=0
... | output | 1 | 8,553 | 0 | 17,107 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can ... | instruction | 0 | 8,554 | 0 | 17,108 |
Yes | output | 1 | 8,554 | 0 | 17,109 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can ... | instruction | 0 | 8,555 | 0 | 17,110 |
Yes | output | 1 | 8,555 | 0 | 17,111 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can ... | instruction | 0 | 8,556 | 0 | 17,112 |
Yes | output | 1 | 8,556 | 0 | 17,113 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can ... | instruction | 0 | 8,557 | 0 | 17,114 |
Yes | output | 1 | 8,557 | 0 | 17,115 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can ... | instruction | 0 | 8,558 | 0 | 17,116 |
No | output | 1 | 8,558 | 0 | 17,117 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can ... | instruction | 0 | 8,559 | 0 | 17,118 |
No | output | 1 | 8,559 | 0 | 17,119 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can ... | instruction | 0 | 8,560 | 0 | 17,120 |
No | output | 1 | 8,560 | 0 | 17,121 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.
String s has exactly n/2 zeroes and n/2 ones (n is even).
In one operation you can ... | instruction | 0 | 8,561 | 0 | 17,122 |
No | output | 1 | 8,561 | 0 | 17,123 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome.
A palindrome is a string that reads the same backward as forward, for exa... | instruction | 0 | 8,739 | 0 | 17,478 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
s = input()
cnt = 0
for i in range(len(s)):
if (s[i] != s[len(s) - i - 1]): cnt += 1
print("YES" if (cnt == 2) or (cnt == 0 and len(s) % 2 == 1) else "NO")
``` | output | 1 | 8,739 | 0 | 17,479 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome.
A palindrome is a string that reads the same backward as forward, for exa... | instruction | 0 | 8,740 | 0 | 17,480 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
s=input()
n=len(s)
c=0
for i in range(n//2):
if(s[i]!=s[n-i-1]):
c=c+1
if(c==1):
print("YES")
elif(n%2==1 and c==0):
print("YES")
else:
print("NO")
``` | output | 1 | 8,740 | 0 | 17,481 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome.
A palindrome is a string that reads the same backward as forward, for exa... | instruction | 0 | 8,741 | 0 | 17,482 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
x = list(input())
g = len(x)
p = g//2
w = 0
if g%2==0:
q = x[:p]+x[:p][::-1]
elif x[::-1]==x and g%2!=0:
print("YES")
quit()
else:
q = x[:p+1]+x[:p][::-1]
for i in range(p,g):
if x[i]!=q[i-g]:
w+=1
if w == 1:
print... | output | 1 | 8,741 | 0 | 17,483 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome.
A palindrome is a string that reads the same backward as forward, for exa... | instruction | 0 | 8,742 | 0 | 17,484 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
def main():
s = input()
n = len(s)
l = 0
r = n-1
cnt = 0
while(l<=r):
if(s[l]!=s[r]):
cnt+=1
l+=1
r-=1
if(cnt>1):
print("NO")
return
if(cnt==1 or n%2=... | output | 1 | 8,742 | 0 | 17,485 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome.
A palindrome is a string that reads the same backward as forward, for exa... | instruction | 0 | 8,743 | 0 | 17,486 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
s=input()
count=0
i=0
j=len(s)-1
while i<j:
if s[i]!=s[j]:
count+=1
i=i+1
j=j-1
if count==1:
print('YES')
elif count==0:
if len(s)%2==0:
print('NO')
else:
print("YES")
else:
print('NO')
``... | output | 1 | 8,743 | 0 | 17,487 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome.
A palindrome is a string that reads the same backward as forward, for exa... | instruction | 0 | 8,744 | 0 | 17,488 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
s=input()
if len(s)%2==0:
t=s[:len(s)//2]
y=s[len(s)//2:]
y=y[::-1]
c=0
for i in range(len(s)//2):
if t[i]!=y[i]:
c=c+1
if c!=1:
print("NO")
else:
print("YES")
else:
t = s[:len(s... | output | 1 | 8,744 | 0 | 17,489 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome.
A palindrome is a string that reads the same backward as forward, for exa... | instruction | 0 | 8,745 | 0 | 17,490 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
s = input()
c = 0
if (s[::-1] == s and len(s)&1 == 1):
print("YES")
exit()
for i in range(len(s)//2):
if s[i] != s[-i-1]:
c+=1
print("NO YES".split()[c==1])
``` | output | 1 | 8,745 | 0 | 17,491 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome.
A palindrome is a string that reads the same backward as forward, for exa... | instruction | 0 | 8,746 | 0 | 17,492 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
n=input()
t=0
for i in range(len(n)//2):
if(n[i]!=n[len(n)-i-1]):
t+=1
if(t==1 or (t==0 and len(n)%2==1)):
print("YES")
else:
print("NO")
``` | output | 1 | 8,746 | 0 | 17,493 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's call it pretty if following conditions are met:
... | instruction | 0 | 8,763 | 0 | 17,526 |
Tags: brute force, implementation, strings
Correct Solution:
```
n = int(input())
s = input() + 'Z'
ans = 0
lst = []
for it in s:
if 'A'<=it<='Z':
temp = len(set(lst))
ans = temp if temp>ans else ans
lst = []
else:
lst.append(it)
print(ans)
``` | output | 1 | 8,763 | 0 | 17,527 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's call it pretty if following conditions are met:
... | instruction | 0 | 8,764 | 0 | 17,528 |
Tags: brute force, implementation, strings
Correct Solution:
```
n = int(input())
s = input()
ans = 0
S = set()
for i in range(n):
if 'a' <= s[i] <= 'z':
S.add(s[i])
if len(S) > ans:
ans = len(S)
else:
S = set()
print(ans)
``` | output | 1 | 8,764 | 0 | 17,529 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's call it pretty if following conditions are met:
... | instruction | 0 | 8,765 | 0 | 17,530 |
Tags: brute force, implementation, strings
Correct Solution:
```
import re
input()
t = re.sub(r'[A-Z]', ' ', input())
print(max(len(set(s)) for s in t.split(' ')))
# Made By Mostafa_Khaled
``` | output | 1 | 8,765 | 0 | 17,531 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's call it pretty if following conditions are met:
... | instruction | 0 | 8,766 | 0 | 17,532 |
Tags: brute force, implementation, strings
Correct Solution:
```
n=int(input())
s=input()
i=0
letter=[]
num=[]
while i<n :
if s[i].islower()and letter.count(s[i])==0 :
letter.append(s[i])
if s[i].isupper()or i==n-1:
num.append(len(letter))
letter=[]
i+=1
if len(num)!=0:
print(max... | output | 1 | 8,766 | 0 | 17,533 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's call it pretty if following conditions are met:
... | instruction | 0 | 8,767 | 0 | 17,534 |
Tags: brute force, implementation, strings
Correct Solution:
```
n = int(input())
s = input().strip()
m = set()
result =0
for i in s:
if(not i.isupper()):
m.add(i);
else:
if(len(m)>result):
result = len(m)
m.clear()
if(len(m)>result):
result = len(m)
print(result)
``` | output | 1 | 8,767 | 0 | 17,535 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's call it pretty if following conditions are met:
... | instruction | 0 | 8,768 | 0 | 17,536 |
Tags: brute force, implementation, strings
Correct Solution:
```
t=int(input())
s=input()
# print(t)
# print(s)
ms = set([])
max = 0
for i in range(t):
if s[i].islower():
ms.add(s[i])
if len(ms) > max:
max = len(ms)
else:
ms = set([])
print(max)
``` | output | 1 | 8,768 | 0 | 17,537 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's call it pretty if following conditions are met:
... | instruction | 0 | 8,769 | 0 | 17,538 |
Tags: brute force, implementation, strings
Correct Solution:
```
#!/usr/bin/env python
def main():
_ = int(input())
ssplit = ''
for c in input():
ssplit += '0' if c.isupper() else c
res = max([len(set(sset)) for sset in ssplit.split('0')])
print(res)
if __name__ == '__main__':
ma... | output | 1 | 8,769 | 0 | 17,539 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's call it pretty if following conditions are met:
... | instruction | 0 | 8,770 | 0 | 17,540 |
Tags: brute force, implementation, strings
Correct Solution:
```
n=int(input())
s=input()
f=0
cnt=''
c=mx=0
for i in range(n):
if s[i].isupper():
f=0
mx=max(mx,c)
c=0
cnt=''
else:
f=1
if s[i] not in cnt:
cnt+=s[i]
c+=1
if f==1:
mx=... | output | 1 | 8,770 | 0 | 17,541 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's c... | instruction | 0 | 8,771 | 0 | 17,542 |
Yes | output | 1 | 8,771 | 0 | 17,543 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's c... | instruction | 0 | 8,772 | 0 | 17,544 |
Yes | output | 1 | 8,772 | 0 | 17,545 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's c... | instruction | 0 | 8,773 | 0 | 17,546 |
Yes | output | 1 | 8,773 | 0 | 17,547 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's c... | instruction | 0 | 8,774 | 0 | 17,548 |
Yes | output | 1 | 8,774 | 0 | 17,549 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's c... | instruction | 0 | 8,775 | 0 | 17,550 |
No | output | 1 | 8,775 | 0 | 17,551 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's c... | instruction | 0 | 8,776 | 0 | 17,552 |
No | output | 1 | 8,776 | 0 | 17,553 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.