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.
You are given a string s of length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "codeforces", but string "coder" is not.
Your t... | instruction | 0 | 10,832 | 0 | 21,664 |
Tags: combinatorics, math, strings
Correct Solution:
```
MOD = 998244353
n = int(input())
s = input()
pref = s[0]
suff = s[-1]
lpref = 0
lsuff = 0
for i in range(len(s)):
if s[i] == pref:
lpref = lpref + 1
else:
break
for i in range(len(s)):
if s[len(s)-1-i] == suff:
lsuff = lsuff... | output | 1 | 10,832 | 0 | 21,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a string s of length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "codeforces", but string "coder" is not.
Your t... | instruction | 0 | 10,833 | 0 | 21,666 |
Tags: combinatorics, math, strings
Correct Solution:
```
modu = 998244353
n = int(input())
s = input()
# first = s[0]
fans = 0
for i in range(n):
if s[i] == s[0]:
fans = fans+1
else:
break
s2 = s[::-1]
lans = 0
for i in range(n):
if s2[i] == s2[0]:
lans = lans+1
else:
br... | output | 1 | 10,833 | 0 | 21,667 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a string s of length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "codeforces", but string "coder" is not.
Your t... | instruction | 0 | 10,834 | 0 | 21,668 |
Tags: combinatorics, math, strings
Correct Solution:
```
import sys
#import math
data = sys.stdin.readlines()
n = data[0]
s = data[1]
s = list(s[:len(s) - 1])
diferente1 = -1
diferente2 = -1
for i in range(len(s)):
if s[i] != s[0] and diferente1 == -1:
diferente1 = i
if s[-(i+1)] != s[-1] and diferente2 == -... | output | 1 | 10,834 | 0 | 21,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a string s of length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "codeforces", but string "coder" is not.
Your t... | instruction | 0 | 10,835 | 0 | 21,670 |
Tags: combinatorics, math, strings
Correct Solution:
```
from sys import stdin,stdout
n=int(stdin.readline())
st=stdin.readline()
cntl=0
cntr=0
for i in st:
if(st[0] == i):
cntl+=1
else:
break
for j in range(n-1,-1,-1):
if(st[j] == st[n-1]):
cntr+=1
else:
break
if(st[0] == st[n-1]):
print(((cntl+1)*(cntr+1... | output | 1 | 10,835 | 0 | 21,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a string s of length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "codeforces", but string "coder" is not.
Your t... | instruction | 0 | 10,836 | 0 | 21,672 |
Tags: combinatorics, math, strings
Correct Solution:
```
import sys,math,bisect
from random import randint
inf = float('inf')
mod = 998244353
"========================================"
def lcm(a,b):
return int((a/math.gcd(a,b))*b)
def gcd(a,b):
return int(math.gcd(a,b))
def tobinary(n):
return bin(n)[2:]
de... | output | 1 | 10,836 | 0 | 21,673 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a string s of length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "codeforces", but string "coder" is not.
Your t... | instruction | 0 | 10,837 | 0 | 21,674 |
Tags: combinatorics, math, strings
Correct Solution:
```
import sys
n = int((sys.stdin.readline()).strip())
s = (sys.stdin.readline()).strip()
counter = {}
lower = 0
for i in range(n):
counter[s[i]]=1
if len(counter)>1:
lower = i
break
counter = {}
upper = n-1
for i in reversed(range(n)):
c... | output | 1 | 10,837 | 0 | 21,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a string s of length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "codeforces", but string "coder" is not.
Your t... | instruction | 0 | 10,838 | 0 | 21,676 |
Tags: combinatorics, math, strings
Correct Solution:
```
n = int(input())
s = list(input())
c =[s[0]]
m =[s[-1]]
for i in range(len(s)-1):
if(s[i]==s[i+1]):
c.append(s[i+1])
else:
break
s.reverse()
for i in range(len(s)-1):
if(s[i]==s[i+1]):
m.append(s[i+1])
else:
break
... | output | 1 | 10,838 | 0 | 21,677 |
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 length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "... | instruction | 0 | 10,839 | 0 | 21,678 |
Yes | output | 1 | 10,839 | 0 | 21,679 |
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 length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "... | instruction | 0 | 10,840 | 0 | 21,680 |
Yes | output | 1 | 10,840 | 0 | 21,681 |
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 length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "... | instruction | 0 | 10,841 | 0 | 21,682 |
Yes | output | 1 | 10,841 | 0 | 21,683 |
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 length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "... | instruction | 0 | 10,842 | 0 | 21,684 |
Yes | output | 1 | 10,842 | 0 | 21,685 |
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 length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "... | instruction | 0 | 10,843 | 0 | 21,686 |
No | output | 1 | 10,843 | 0 | 21,687 |
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 length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "... | instruction | 0 | 10,844 | 0 | 21,688 |
No | output | 1 | 10,844 | 0 | 21,689 |
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 length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "... | instruction | 0 | 10,845 | 0 | 21,690 |
No | output | 1 | 10,845 | 0 | 21,691 |
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 length n consisting only of lowercase Latin letters.
A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "... | instruction | 0 | 10,846 | 0 | 21,692 |
No | output | 1 | 10,846 | 0 | 21,693 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Returning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its reverse. For example, strings "pop", "noon", "x", and "kkkkkk" are palindromes, while strings "moo... | instruction | 0 | 10,897 | 0 | 21,794 |
Tags: brute force, constructive algorithms, greedy, implementation, strings
Correct Solution:
```
from sys import stdin, stdout
from math import *
from heapq import *
from collections import *
def is_palind(s):
ln=len(s)
for i in range(ln):
if (s[i] != s[ln-1-i]):
return False
return Tr... | output | 1 | 10,897 | 0 | 21,795 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Returning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its reverse. For example, strings "pop", "noon", "x", a... | instruction | 0 | 10,901 | 0 | 21,802 |
Yes | output | 1 | 10,901 | 0 | 21,803 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Returning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its reverse. For example, strings "pop", "noon", "x", a... | instruction | 0 | 10,902 | 0 | 21,804 |
Yes | output | 1 | 10,902 | 0 | 21,805 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Returning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its reverse. For example, strings "pop", "noon", "x", a... | instruction | 0 | 10,903 | 0 | 21,806 |
Yes | output | 1 | 10,903 | 0 | 21,807 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Returning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its reverse. For example, strings "pop", "noon", "x", a... | instruction | 0 | 10,904 | 0 | 21,808 |
Yes | output | 1 | 10,904 | 0 | 21,809 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Returning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its reverse. For example, strings "pop", "noon", "x", a... | instruction | 0 | 10,905 | 0 | 21,810 |
No | output | 1 | 10,905 | 0 | 21,811 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Returning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its reverse. For example, strings "pop", "noon", "x", a... | instruction | 0 | 10,906 | 0 | 21,812 |
No | output | 1 | 10,906 | 0 | 21,813 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Returning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its reverse. For example, strings "pop", "noon", "x", a... | instruction | 0 | 10,907 | 0 | 21,814 |
No | output | 1 | 10,907 | 0 | 21,815 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Returning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its reverse. For example, strings "pop", "noon", "x", a... | instruction | 0 | 10,908 | 0 | 21,816 |
No | output | 1 | 10,908 | 0 | 21,817 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to exactly one of the strings a_i. The strings a_... | instruction | 0 | 10,925 | 0 | 21,850 |
Tags: constructive algorithms, greedy, sortings, strings
Correct Solution:
```
import math
cases = int(input())
for t in range(cases):
n,k = list(map(int,input().split()))
s = ''.join(sorted(input()))
if k==1:
print(''.join(s))
elif s[0]!=s[k-1]:
print(s[k-1])
else:
if s[0]==... | output | 1 | 10,925 | 0 | 21,851 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to exactly one of the strings a_i. The strings a_... | instruction | 0 | 10,926 | 0 | 21,852 |
Tags: constructive algorithms, greedy, sortings, strings
Correct Solution:
```
for _ in range(int(input())):
n,k = map(int,input().split())
given = sorted(input())
if len(set(given[:k]))!=1:
ans = given[k-1]
else:
ans = ''
if len(set(given[k:]))==1:
for i in range(0,n... | output | 1 | 10,926 | 0 | 21,853 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to exactly one of the strings a_i. The strings a_... | instruction | 0 | 10,927 | 0 | 21,854 |
Tags: constructive algorithms, greedy, sortings, strings
Correct Solution:
```
# cook your dish here
t=int(input())
for _ in range(t):
n,k=map(int,input().split())
s=list(input())
s.sort()
c=s[0]
if s[k-1]!=c:
print(s[k-1])
else:
x=set(s[k:])
if len(x)==0 or len(x)==1:
... | output | 1 | 10,927 | 0 | 21,855 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to exactly one of the strings a_i. The strings a_... | instruction | 0 | 10,928 | 0 | 21,856 |
Tags: constructive algorithms, greedy, sortings, strings
Correct Solution:
```
for lo in range(int(input())):
#n = int(input())
n,k = map(int,input().split())
st = input()
ls = [0 for i in range(26)]
c = 0
mn = 30
for i in st:
x = ord(i)-97
if ls[x]==0:
c+=1
... | output | 1 | 10,928 | 0 | 21,857 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to exactly one of the strings a_i. The strings a_... | instruction | 0 | 10,929 | 0 | 21,858 |
Tags: constructive algorithms, greedy, sortings, strings
Correct Solution:
```
for _ in range(int(input())):
n,k = map(int, input().split())
s = ''.join(sorted(input()))
if(s[0] != s[k-1] or k == n):
print(s[k-1])
continue
if(s[k] != s[n-1]):
print(s[0]+s[k:])
else:
print(s[0]+s[... | output | 1 | 10,929 | 0 | 21,859 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to exactly one of the strings a_i. The strings a_... | instruction | 0 | 10,930 | 0 | 21,860 |
Tags: constructive algorithms, greedy, sortings, strings
Correct Solution:
```
import math
t = int(input())
for _ in range(t):
n,m = map(int,input().split())
s = input()
s1 = [i for i in s]
s1.sort()
s = ''.join(s1)
#print(s)
if m==n:
print(s[n-1])
continue
if m==1:
... | output | 1 | 10,930 | 0 | 21,861 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to exactly one of the strings a_i. The strings a_... | instruction | 0 | 10,931 | 0 | 21,862 |
Tags: constructive algorithms, greedy, sortings, strings
Correct Solution:
```
I=input
exec(int(I())*"n,k=map(int,I().split());s=''.join(sorted(I()));c=s[k-1];print(c+(c==s[0])*s[k::k**(s[k%n]==s[-1])]);")
``` | output | 1 | 10,931 | 0 | 21,863 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to exactly one of the strings a_i. The strings a_... | instruction | 0 | 10,932 | 0 | 21,864 |
Tags: constructive algorithms, greedy, sortings, strings
Correct Solution:
```
#ライブラリインポート
from collections import defaultdict
con = 10 ** 9 + 7
#入力受け取り
def getlist():
return list(map(int, input().split()))
#処理内容
def main():
T = int(input())
for i in range(T):
N, K = getlist()
s = sorted(list(input()))
#面倒
... | output | 1 | 10,932 | 0 | 21,865 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to... | instruction | 0 | 10,933 | 0 | 21,866 |
Yes | output | 1 | 10,933 | 0 | 21,867 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to... | instruction | 0 | 10,934 | 0 | 21,868 |
Yes | output | 1 | 10,934 | 0 | 21,869 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to... | instruction | 0 | 10,935 | 0 | 21,870 |
Yes | output | 1 | 10,935 | 0 | 21,871 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to... | instruction | 0 | 10,936 | 0 | 21,872 |
Yes | output | 1 | 10,936 | 0 | 21,873 |
Evaluate the correctness of the submitted Python 2 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to... | instruction | 0 | 10,937 | 0 | 21,874 |
Yes | output | 1 | 10,937 | 0 | 21,875 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to... | instruction | 0 | 10,938 | 0 | 21,876 |
No | output | 1 | 10,938 | 0 | 21,877 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to... | instruction | 0 | 10,939 | 0 | 21,878 |
No | output | 1 | 10,939 | 0 | 21,879 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to... | instruction | 0 | 10,940 | 0 | 21,880 |
No | output | 1 | 10,940 | 0 | 21,881 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to... | instruction | 0 | 10,941 | 0 | 21,882 |
No | output | 1 | 10,941 | 0 | 21,883 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given the strings a and b, consisting of lowercase Latin letters. You can do any number of the following operations in any order:
* if |a| > 0 (the length of the string a is greater than zero), delete the first character of the s... | instruction | 0 | 10,990 | 0 | 21,980 |
Tags: brute force, implementation, strings
Correct Solution:
```
t=int(input())
for _ in range(t):
a=str(input())
b=str(input())
x=len(a)
y=len(b)
if x>y:
mini=0
for i in range(y):
for j in range(i+1,y+1):
s=b[i:j]
l=j-i
p=0... | output | 1 | 10,990 | 0 | 21,981 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given the strings a and b, consisting of lowercase Latin letters. You can do any number of the following operations in any order:
* if |a| > 0 (the length of the string a is greater than zero), delete the first character of the s... | instruction | 0 | 10,991 | 0 | 21,982 |
Tags: brute force, implementation, strings
Correct Solution:
```
for i in range(int(input())):
a=list(input())
b=list(input())
a1=len(a)
b1=len(b)
if a1>b1:
a1,b1=b1,a1
a,b=b,a
s=[]
for i in range(a1):
for j in range(i+1,a1+1):
s.append(a[i:j])
s1=0
... | output | 1 | 10,991 | 0 | 21,983 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given the strings a and b, consisting of lowercase Latin letters. You can do any number of the following operations in any order:
* if |a| > 0 (the length of the string a is greater than zero), delete the first character of the s... | instruction | 0 | 10,992 | 0 | 21,984 |
Tags: brute force, implementation, strings
Correct Solution:
```
def getCharNGram(n,s):
charGram = [''.join(s[i:i+n]) for i in range(len(s)-n+1)]
return charGram
t = int(input())
for _ in range(t):
A = input()
B = input()
if len(A) < len(B):
ans = len(B)+len(A)
for i in range(1,len(... | output | 1 | 10,992 | 0 | 21,985 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given the strings a and b, consisting of lowercase Latin letters. You can do any number of the following operations in any order:
* if |a| > 0 (the length of the string a is greater than zero), delete the first character of the s... | instruction | 0 | 10,993 | 0 | 21,986 |
Tags: brute force, implementation, strings
Correct Solution:
```
T = int(input())
for _ in range(T):
a = input()
b = input()
out = len(a) + len(b)
for i in range(len(a)):
for j in range(len(a), i, -1):
if a[i:j] in b:
out = min(out, len(a)+len(b)-2*(j-i))
p... | output | 1 | 10,993 | 0 | 21,987 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given the strings a and b, consisting of lowercase Latin letters. You can do any number of the following operations in any order:
* if |a| > 0 (the length of the string a is greater than zero), delete the first character of the s... | instruction | 0 | 10,994 | 0 | 21,988 |
Tags: brute force, implementation, strings
Correct Solution:
```
from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
a = input().rstrip()
b = input().rstrip()
aa = set()
bb = set()
for i in range(len(a)):
c = []
for j in range(i, len(a)):
c.a... | output | 1 | 10,994 | 0 | 21,989 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given the strings a and b, consisting of lowercase Latin letters. You can do any number of the following operations in any order:
* if |a| > 0 (the length of the string a is greater than zero), delete the first character of the s... | instruction | 0 | 10,995 | 0 | 21,990 |
Tags: brute force, implementation, strings
Correct Solution:
```
import sys,functools,collections,bisect,math,heapq
input = sys.stdin.readline
#print = sys.stdout.write
def fun(A ,B):
n = len(A)
m = len(B)
#Edge cases.
if m == 0 or n == 0:
return 0
if n == 1 and m == 1:
if A[0] == B[0]:
return 1
else:
... | output | 1 | 10,995 | 0 | 21,991 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given the strings a and b, consisting of lowercase Latin letters. You can do any number of the following operations in any order:
* if |a| > 0 (the length of the string a is greater than zero), delete the first character of the s... | instruction | 0 | 10,996 | 0 | 21,992 |
Tags: brute force, implementation, strings
Correct Solution:
```
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstri... | output | 1 | 10,996 | 0 | 21,993 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given the strings a and b, consisting of lowercase Latin letters. You can do any number of the following operations in any order:
* if |a| > 0 (the length of the string a is greater than zero), delete the first character of the s... | instruction | 0 | 10,997 | 0 | 21,994 |
Tags: brute force, implementation, strings
Correct Solution:
```
n = int(input())
for i in range(n):
s1 = input()
s2 = input()
if (len(s1) > len(s2)): s1, s2 = s2, s1
max = 0
for j in range(len(s1)):
for k in range(j, len(s1)):
found = s2.find(s1[j:k+1])
if (found ... | output | 1 | 10,997 | 0 | 21,995 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.
Paul has found a tolera... | instruction | 0 | 11,141 | 0 | 22,282 |
Tags: greedy, strings
Correct Solution:
```
import sys
from math import log2,floor,ceil,sqrt,gcd
import bisect
# from collections import deque
# sys.setrecursionlimit(10**5)
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
def input(): return sys.stdin.readline()... | output | 1 | 11,141 | 0 | 22,283 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.