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 two strings s and t. Both strings have length n and consist of lowercase Latin letters. The characters in the strings are numbered from 1 to n.
You can successively perform the following move any number of times (possibly, zer... | instruction | 0 | 22,849 | 0 | 45,698 |
Tags: implementation
Correct Solution:
```
n = int(input())
s = list(input())
t = list(input())
k = n
i = 0
ans=0
c=[]
while n!=0:
if s[i]!=t[i]:
j=i
while j<k and s[j]!=t[i]:
j+=1
if j==k:
ans=-1
break
save=s[j]
del s[j]
while j !=... | output | 1 | 22,849 | 0 | 45,699 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two strings s and t. Both strings have length n and consist of lowercase Latin letters. The characters in the strings are numbered from 1 to n.
You can successively perform the fo... | instruction | 0 | 22,850 | 0 | 45,700 |
Yes | output | 1 | 22,850 | 0 | 45,701 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two strings s and t. Both strings have length n and consist of lowercase Latin letters. The characters in the strings are numbered from 1 to n.
You can successively perform the fo... | instruction | 0 | 22,851 | 0 | 45,702 |
Yes | output | 1 | 22,851 | 0 | 45,703 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two strings s and t. Both strings have length n and consist of lowercase Latin letters. The characters in the strings are numbered from 1 to n.
You can successively perform the fo... | instruction | 0 | 22,852 | 0 | 45,704 |
Yes | output | 1 | 22,852 | 0 | 45,705 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two strings s and t. Both strings have length n and consist of lowercase Latin letters. The characters in the strings are numbered from 1 to n.
You can successively perform the fo... | instruction | 0 | 22,853 | 0 | 45,706 |
Yes | output | 1 | 22,853 | 0 | 45,707 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two strings s and t. Both strings have length n and consist of lowercase Latin letters. The characters in the strings are numbered from 1 to n.
You can successively perform the fo... | instruction | 0 | 22,854 | 0 | 45,708 |
No | output | 1 | 22,854 | 0 | 45,709 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two strings s and t. Both strings have length n and consist of lowercase Latin letters. The characters in the strings are numbered from 1 to n.
You can successively perform the fo... | instruction | 0 | 22,855 | 0 | 45,710 |
No | output | 1 | 22,855 | 0 | 45,711 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two strings s and t. Both strings have length n and consist of lowercase Latin letters. The characters in the strings are numbered from 1 to n.
You can successively perform the fo... | instruction | 0 | 22,856 | 0 | 45,712 |
No | output | 1 | 22,856 | 0 | 45,713 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two strings s and t. Both strings have length n and consist of lowercase Latin letters. The characters in the strings are numbered from 1 to n.
You can successively perform the fo... | instruction | 0 | 22,857 | 0 | 45,714 |
No | output | 1 | 22,857 | 0 | 45,715 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a binary string s.
Find the number of distinct cyclical binary strings of length n which contain s as a substring.
The cyclical string t contains s as a substring if there is some cyclical shift of string t, such that s is a ... | instruction | 0 | 22,858 | 0 | 45,716 |
Tags: dp, strings
Correct Solution:
```
n=int(input())
s=[c=='1' for c in input()]
m=len(s)
z=[[0,0]]
for c in s:
ind = z[-1][c]
z[-1][c] = len(z)
z.append(z[ind][:])
assert(len(z) == m+1)
z[m][0] = z[m][1] = m # make it sticky
# how many things match directly
dp = [0 for _ in range(m+1)]
dp[0] = 1
for i in range(n... | output | 1 | 22,858 | 0 | 45,717 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a binary string s.
Find the number of distinct cyclical binary strings of length n which contain s as a substring.
The cyclical string t contains s as a substring if there is som... | instruction | 0 | 22,859 | 0 | 45,718 |
No | output | 1 | 22,859 | 0 | 45,719 |
Provide a correct Python 3 solution for this coding contest problem.
Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.
Operation: Choose one character of S and replace it with a different character.
Constraints
* S and T ha... | instruction | 0 | 23,558 | 0 | 47,116 |
"Correct Solution:
```
S = input()
T = input()
print(len([i for i in range(len(S)) if S[i] != T[i]]))
``` | output | 1 | 23,558 | 0 | 47,117 |
Provide a correct Python 3 solution for this coding contest problem.
Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.
Operation: Choose one character of S and replace it with a different character.
Constraints
* S and T ha... | instruction | 0 | 23,560 | 0 | 47,120 |
"Correct Solution:
```
print(sum(c!=d for c,d in zip(input(),input())))
``` | output | 1 | 23,560 | 0 | 47,121 |
Provide a correct Python 3 solution for this coding contest problem.
Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.
Operation: Choose one character of S and replace it with a different character.
Constraints
* S and T ha... | instruction | 0 | 23,561 | 0 | 47,122 |
"Correct Solution:
```
s = input()
t = input()
print(sum([s[i] != t[i] for i in range(len(s))]))
``` | output | 1 | 23,561 | 0 | 47,123 |
Provide a correct Python 3 solution for this coding contest problem.
Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.
Operation: Choose one character of S and replace it with a different character.
Constraints
* S and T ha... | instruction | 0 | 23,562 | 0 | 47,124 |
"Correct Solution:
```
s = input()
t = input()
ans = 0
for a,b in zip(s,t):
ans += (a != b)
print(ans)
``` | output | 1 | 23,562 | 0 | 47,125 |
Provide a correct Python 3 solution for this coding contest problem.
Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.
Operation: Choose one character of S and replace it with a different character.
Constraints
* S and T ha... | instruction | 0 | 23,563 | 0 | 47,126 |
"Correct Solution:
```
s = list(input()); t = list(input())
print(sum([1 for i,j in zip(s,t) if i!=j]))
``` | output | 1 | 23,563 | 0 | 47,127 |
Provide a correct Python 3 solution for this coding contest problem.
Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.
Operation: Choose one character of S and replace it with a different character.
Constraints
* S and T ha... | instruction | 0 | 23,564 | 0 | 47,128 |
"Correct Solution:
```
n=input()
t=input()
c=0
for i in range(len(n)):
if n[i]!=t[i]:
c+=1
print(c)
``` | output | 1 | 23,564 | 0 | 47,129 |
Provide a correct Python 3 solution for this coding contest problem.
Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.
Operation: Choose one character of S and replace it with a different character.
Constraints
* S and T ha... | instruction | 0 | 23,565 | 0 | 47,130 |
"Correct Solution:
```
a=input()
b=input()
n=len(a)
c=0
for i in range(n):
if(a[i]!=b[i]):
c+=1
print(c)
``` | output | 1 | 23,565 | 0 | 47,131 |
Provide a correct Python 3 solution for this coding contest problem.
Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:
* f(A, B) has length A + B;
* f(A, B) contains exactly A letters `A` and exactly B letters `B`;
* The length of the longest substring of f(A, B) con... | instruction | 0 | 23,654 | 0 | 47,308 |
"Correct Solution:
```
for t in range(int(input())):
a,b,c,d=map(int,input().split(' '))
l,x,y,o=(a+b)//(min(a,b)+1),0,0,""
if a*l<=b:y=a+b
elif b*l<=a:x=a+b
else:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-... | output | 1 | 23,654 | 0 | 47,309 |
Provide a correct Python 3 solution for this coding contest problem.
Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:
* f(A, B) has length A + B;
* f(A, B) contains exactly A letters `A` and exactly B letters `B`;
* The length of the longest substring of f(A, B) con... | instruction | 0 | 23,655 | 0 | 47,310 |
"Correct Solution:
```
T=int(input())
for TT in range(T):
a,b,c,d=map(int,input().split(' '))
l,x,y=(a+b)//(min(a,b)+1),0,0
if a*l<=b:
y=a+b
elif b*l<=a:
x=a+b
else:
x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
out=""
for i in range(c,d+1):
if i<=x:
out+="AB"... | output | 1 | 23,655 | 0 | 47,311 |
Provide a correct Python 3 solution for this coding contest problem.
Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:
* f(A, B) has length A + B;
* f(A, B) contains exactly A letters `A` and exactly B letters `B`;
* The length of the longest substring of f(A, B) con... | instruction | 0 | 23,656 | 0 | 47,312 |
"Correct Solution:
```
for t in range(int(input())):
a,b,c,d=map(int,input().split(' '));l,x,y,o=(a+b)//(min(a,b)+1),0,0,""
if a*l<=b:y=a+b
elif b*l<=a:x=a+b
else:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y... | output | 1 | 23,656 | 0 | 47,313 |
Provide a correct Python 3 solution for this coding contest problem.
Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:
* f(A, B) has length A + B;
* f(A, B) contains exactly A letters `A` and exactly B letters `B`;
* The length of the longest substring of f(A, B) con... | instruction | 0 | 23,657 | 0 | 47,314 |
"Correct Solution:
```
T=int(input())
for TT in range(T):
a,b,c,d=map(int,input().split(' '))
l,x,y=(a+b)//(min(a,b)+1),0,0
if a*l<=b:
y=a+b
elif b*l<=a:
x=a+b
else:
x,y=(a*l-b)//(l-1),(b*l-a)//(l-1) #Like G2 tong long
out=""
for i in range(c,d+1):
if i<=x:
out+="AB"[i%(l+1)==0]
elif a+b-i+1<=y:
... | output | 1 | 23,657 | 0 | 47,315 |
Provide a correct Python 3 solution for this coding contest problem.
Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:
* f(A, B) has length A + B;
* f(A, B) contains exactly A letters `A` and exactly B letters `B`;
* The length of the longest substring of f(A, B) con... | instruction | 0 | 23,658 | 0 | 47,316 |
"Correct Solution:
```
T=int(input())
for TT in range(T):
a,b,c,d=map(int,input().split(' '))
l,x,y,out=(a+b)//(min(a,b)+1),0,0,""
if a*l<=b:y=a+b
elif b*l<=a:x=a+b
else:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
for i in range(c,d+1):out+=("AB"[i%(l+1)==0]) if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a... | output | 1 | 23,658 | 0 | 47,317 |
Provide a correct Python 3 solution for this coding contest problem.
Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:
* f(A, B) has length A + B;
* f(A, B) contains exactly A letters `A` and exactly B letters `B`;
* The length of the longest substring of f(A, B) con... | instruction | 0 | 23,659 | 0 | 47,318 |
"Correct Solution:
```
#!/usr/bin/env python3
import math
Q = int(input())
num = lambda x: (x, max(0, (x - 1) // K))
sub = lambda xs, ys: [x - y for (x, y) in zip(xs, ys)]
for _ in range(Q):
A, B, C, D = map(int, input().split())
K = math.ceil(max(A, B) / (min(A, B) + 1))
l, r = 0, A + 1
while r - l > 1... | output | 1 | 23,659 | 0 | 47,319 |
Provide a correct Python 3 solution for this coding contest problem.
Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:
* f(A, B) has length A + B;
* f(A, B) contains exactly A letters `A` and exactly B letters `B`;
* The length of the longest substring of f(A, B) con... | instruction | 0 | 23,660 | 0 | 47,320 |
"Correct Solution:
```
#!/usr/bin/env python3
import math
Q = int(input())
for _ in range(Q):
A, B, C, D = map(int, input().split())
K = math.ceil(max(A, B) / (min(A, B) + 1))
lo, hi = 0, A + 1
while hi - lo > 1:
mid = (lo + hi) // 2
rA, rB = A - mid, B - max(0, (mid - 1) // K)
i... | output | 1 | 23,660 | 0 | 47,321 |
Provide a correct Python 3 solution for this coding contest problem.
Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:
* f(A, B) has length A + B;
* f(A, B) contains exactly A letters `A` and exactly B letters `B`;
* The length of the longest substring of f(A, B) con... | instruction | 0 | 23,661 | 0 | 47,322 |
"Correct Solution:
```
for t in range(int(input())):
a,b,c,d=map(int,input().split(' '));l,x,y,o=(a+b)//(min(a,b)+1),a+b,0,""
if a*l<=b:x,y=0,a+b
elif b*l>a:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)... | output | 1 | 23,661 | 0 | 47,323 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:
* f(A, B) has length A + B;
* f(A, B) contains exactly A letters `A` and exactly B letters `... | instruction | 0 | 23,662 | 0 | 47,324 |
Yes | output | 1 | 23,662 | 0 | 47,325 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:
* f(A, B) has length A + B;
* f(A, B) contains exactly A letters `A` and exactly B letters `... | instruction | 0 | 23,663 | 0 | 47,326 |
No | output | 1 | 23,663 | 0 | 47,327 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:
* f(A, B) has length A + B;
* f(A, B) contains exactly A letters `A` and exactly B letters `... | instruction | 0 | 23,664 | 0 | 47,328 |
No | output | 1 | 23,664 | 0 | 47,329 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:
* f(A, B) has length A + B;
* f(A, B) contains exactly A letters `A` and exactly B letters `... | instruction | 0 | 23,665 | 0 | 47,330 |
No | output | 1 | 23,665 | 0 | 47,331 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:
* f(A, B) has length A + B;
* f(A, B) contains exactly A letters `A` and exactly B letters `... | instruction | 0 | 23,666 | 0 | 47,332 |
No | output | 1 | 23,666 | 0 | 47,333 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For example, ababa is adorable (you can transform i... | instruction | 0 | 24,448 | 0 | 48,896 |
Tags: implementation
Correct Solution:
```
import math as ma
from sys import exit
def li():
return list(map(int,input().split()))
def num():
return map(int,input().split())
def nu():
return int(input())
s=input()
f=[0]*26
for ch in s:
f[ord(ch)-97]+=1
c=0
x=[]
v=[]
for i in range(26):
if(f[i]>0):
c+=1
x.append... | output | 1 | 24,448 | 0 | 48,897 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For example, ababa is adorable (you can transform i... | instruction | 0 | 24,450 | 0 | 48,900 |
Tags: implementation
Correct Solution:
```
y = input()
x = {i: y.count(i) for i in set(y)}
print('YNEOS'[(any(x[i]<2 for i in x)if len(x)==2 else len(y)<4)if 1<len(x)<5 else 1::2])
``` | output | 1 | 24,450 | 0 | 48,901 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For example, ababa is adorable (you can transform i... | instruction | 0 | 24,451 | 0 | 48,902 |
Tags: implementation
Correct Solution:
```
# http://codeforces.com/problemset/problem/955/B
# Not simply beatiful strings
string = input()
d = {}
for c in string:
try:
d[c] += 1
except:
d[c] = 1
if len(d) == 1:
print('No')
elif len(d) == 2:
valid = True
for v in d.values():
... | output | 1 | 24,451 | 0 | 48,903 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For example, ababa is adorable (you can transform i... | instruction | 0 | 24,453 | 0 | 48,906 |
Tags: implementation
Correct Solution:
```
from functools import reduce
s = input()
num_of_chars_in_s = {}
for char in s:
if char not in num_of_chars_in_s:
num_of_chars_in_s[char] = 0
num_of_chars_in_s[char] += 1
answer = False
if len(num_of_chars_in_s) < 2 or len(num_of_chars_in_s) > 4:
pass ... | output | 1 | 24,453 | 0 | 48,907 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For ... | instruction | 0 | 24,455 | 0 | 48,910 |
Yes | output | 1 | 24,455 | 0 | 48,911 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For ... | instruction | 0 | 24,456 | 0 | 48,912 |
Yes | output | 1 | 24,456 | 0 | 48,913 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For ... | instruction | 0 | 24,457 | 0 | 48,914 |
Yes | output | 1 | 24,457 | 0 | 48,915 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For ... | instruction | 0 | 24,458 | 0 | 48,916 |
Yes | output | 1 | 24,458 | 0 | 48,917 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For ... | instruction | 0 | 24,459 | 0 | 48,918 |
No | output | 1 | 24,459 | 0 | 48,919 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For ... | instruction | 0 | 24,460 | 0 | 48,920 |
No | output | 1 | 24,460 | 0 | 48,921 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For ... | instruction | 0 | 24,461 | 0 | 48,922 |
No | output | 1 | 24,461 | 0 | 48,923 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For ... | instruction | 0 | 24,462 | 0 | 48,924 |
No | output | 1 | 24,462 | 0 | 48,925 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S of length N consisting of uppercase English letters.
How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
Constraints
* 3 \leq N \leq 50
* S consists of uppercase English letters.
Inp... | instruction | 0 | 24,509 | 0 | 49,018 |
"Correct Solution:
```
n = int(input())
print(input().count("ABC"))
``` | output | 1 | 24,509 | 0 | 49,019 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S of length N consisting of uppercase English letters.
How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
Constraints
* 3 \leq N \leq 50
* S consists of uppercase English letters.
Inp... | instruction | 0 | 24,510 | 0 | 49,020 |
"Correct Solution:
```
input()
text = input().split("ABC")
print(len(text)-1)
``` | output | 1 | 24,510 | 0 | 49,021 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S of length N consisting of uppercase English letters.
How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
Constraints
* 3 \leq N \leq 50
* S consists of uppercase English letters.
Inp... | instruction | 0 | 24,511 | 0 | 49,022 |
"Correct Solution:
```
#150_B
n = int(input())
s = input()
print(s.count('ABC'))
``` | output | 1 | 24,511 | 0 | 49,023 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S of length N consisting of uppercase English letters.
How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
Constraints
* 3 \leq N \leq 50
* S consists of uppercase English letters.
Inp... | instruction | 0 | 24,512 | 0 | 49,024 |
"Correct Solution:
```
N = int(input())
X = input()
print(X.count("ABC"))
``` | output | 1 | 24,512 | 0 | 49,025 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S of length N consisting of uppercase English letters.
How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
Constraints
* 3 \leq N \leq 50
* S consists of uppercase English letters.
Inp... | instruction | 0 | 24,513 | 0 | 49,026 |
"Correct Solution:
```
n = int(input())
s = str(input())
print(s.count('ABC'))
``` | output | 1 | 24,513 | 0 | 49,027 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S of length N consisting of uppercase English letters.
How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
Constraints
* 3 \leq N \leq 50
* S consists of uppercase English letters.
Inp... | instruction | 0 | 24,514 | 0 | 49,028 |
"Correct Solution:
```
input()
print(str(input()).count("ABC"))
``` | output | 1 | 24,514 | 0 | 49,029 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S of length N consisting of uppercase English letters.
How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
Constraints
* 3 \leq N \leq 50
* S consists of uppercase English letters.
Inp... | instruction | 0 | 24,515 | 0 | 49,030 |
"Correct Solution:
```
_ = input()
print(input().count('ABC'))
``` | output | 1 | 24,515 | 0 | 49,031 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.