message
stringlengths
2
23.4k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
129
108k
cluster
float64
6
6
__index_level_0__
int64
258
216k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase English letters. He wa...
instruction
0
80,467
6
160,934
Yes
output
1
80,467
6
160,935
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase English letters. He wa...
instruction
0
80,468
6
160,936
Yes
output
1
80,468
6
160,937
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase English letters. He wa...
instruction
0
80,469
6
160,938
Yes
output
1
80,469
6
160,939
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase English letters. He wa...
instruction
0
80,470
6
160,940
Yes
output
1
80,470
6
160,941
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase English letters. He wa...
instruction
0
80,471
6
160,942
No
output
1
80,471
6
160,943
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase English letters. He wa...
instruction
0
80,472
6
160,944
No
output
1
80,472
6
160,945
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase English letters. He wa...
instruction
0
80,473
6
160,946
No
output
1
80,473
6
160,947
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase English letters. He wa...
instruction
0
80,474
6
160,948
No
output
1
80,474
6
160,949
Provide tags and a correct Python 3 solution for this coding contest problem. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Latin letters. There are hyphen characters '-' in...
instruction
0
81,344
6
162,688
Tags: binary search, greedy Correct Solution: ``` import sys #import random from bisect import bisect_left as lb from collections import deque #sys.setrecursionlimit(10**8) from queue import PriorityQueue as pq from math import * input_ = lambda: sys.stdin.readline().strip("\r\n") ii = lambda : int(input_()) il = lambd...
output
1
81,344
6
162,689
Provide tags and a correct Python 3 solution for this coding contest problem. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Latin letters. There are hyphen characters '-' in...
instruction
0
81,345
6
162,690
Tags: binary search, greedy Correct Solution: ``` n = int(input()) xs = list(map(lambda x: len(list(x)) + 1, input().replace('-', ' ').split())) xs[-1] -= 1 def f(xs, n, c): cnt = 1 tmp = 0 for x in xs: if c < x: return False elif c < tmp + x: tmp = 0 cnt ...
output
1
81,345
6
162,691
Provide tags and a correct Python 3 solution for this coding contest problem. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Latin letters. There are hyphen characters '-' in...
instruction
0
81,346
6
162,692
Tags: binary search, greedy Correct Solution: ``` n = int(input()) s = input() d = [] pre = 0 for i in range(len(s)): if s[i] == '-': d.append(pre + 1) pre = 0 elif s[i] == ' ': d.append(pre + 1) pre = 0 else: pre += 1 d.append(pre) def calc(k, n): m = len(d) ...
output
1
81,346
6
162,693
Provide tags and a correct Python 3 solution for this coding contest problem. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Latin letters. There are hyphen characters '-' in...
instruction
0
81,347
6
162,694
Tags: binary search, greedy Correct Solution: ``` #Bhargey Mehta (Sophomore) #DA-IICT, Gandhinagar import sys, math, queue #sys.stdin = open("input.txt", "r") MOD = 10**9+7 sys.setrecursionlimit(1000000) def ok(w): i = 0 c = 0 l = 0 while i < len(x): if c+x[i] <= w: c += x[i] ...
output
1
81,347
6
162,695
Provide tags and a correct Python 3 solution for this coding contest problem. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Latin letters. There are hyphen characters '-' in...
instruction
0
81,348
6
162,696
Tags: binary search, greedy Correct Solution: ``` def solve(): k = int(input()) s = input() s = s.replace('-',' ') x = [len(a) for a in s.split(' ')] x[-1] -= 1 x = x[::-1] def good(z): y = x[:] l = 1 curr = 0 while y: u = y.pop() + 1 ...
output
1
81,348
6
162,697
Provide tags and a correct Python 3 solution for this coding contest problem. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Latin letters. There are hyphen characters '-' in...
instruction
0
81,349
6
162,698
Tags: binary search, greedy Correct Solution: ``` import sys inf = 1 << 30 def solve(): def check(mid): if a_max > mid: return False tot = 1 line = 0 for ai in a: if line + ai > mid: tot += 1 line = ai if to...
output
1
81,349
6
162,699
Provide tags and a correct Python 3 solution for this coding contest problem. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Latin letters. There are hyphen characters '-' in...
instruction
0
81,350
6
162,700
Tags: binary search, greedy Correct Solution: ``` # 803D def do(): k = int(input()) ad = input() def valid(width, limit): l = -1 count = 0 cur = 0 for r in range(len(ad)): if ad[r] == " " or ad[r] == "-": l = r cur += 1 if...
output
1
81,350
6
162,701
Provide tags and a correct Python 3 solution for this coding contest problem. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Latin letters. There are hyphen characters '-' in...
instruction
0
81,351
6
162,702
Tags: binary search, greedy Correct Solution: ``` import sys #Library Info(ACL for Python/Pypy) -> https://github.com/not522/ac-library-python def input(): return sys.stdin.readline().rstrip() DXY = [(0, -1), (1,0), (0, 1), (-1,0)] #L,D,R,Uの順番 def main(): k = int(input()) s = input() V = [] for ...
output
1
81,351
6
162,703
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Lat...
instruction
0
81,352
6
162,704
Yes
output
1
81,352
6
162,705
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Lat...
instruction
0
81,353
6
162,706
Yes
output
1
81,353
6
162,707
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Lat...
instruction
0
81,354
6
162,708
Yes
output
1
81,354
6
162,709
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Lat...
instruction
0
81,355
6
162,710
Yes
output
1
81,355
6
162,711
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Lat...
instruction
0
81,356
6
162,712
No
output
1
81,356
6
162,713
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Lat...
instruction
0
81,357
6
162,714
No
output
1
81,357
6
162,715
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Lat...
instruction
0
81,358
6
162,716
No
output
1
81,358
6
162,717
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Lat...
instruction
0
81,359
6
162,718
No
output
1
81,359
6
162,719
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp came up with a new programming language. There are only two types of statements in it: * "x := s": assign the variable named x the value s (where s is a string). For example, the statement var := hello assigns the variable named...
instruction
0
81,982
6
163,964
Tags: data structures, hashing, implementation, matrices, strings Correct Solution: ``` class Element: def __init__(self, s=''): if len(s) >= 6: self.pref = s[:3] self.suf = s[-3:] else: self.pref = s[:3] self.suf = s[3:] self.ans = calc(s) ...
output
1
81,982
6
163,965
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp came up with a new programming language. There are only two types of statements in it: * "x := s": assign the variable named x the value s (where s is a string). For example, the statement var := hello assigns the variable named...
instruction
0
81,983
6
163,966
Tags: data structures, hashing, implementation, matrices, strings Correct Solution: ``` # Author : nitish420 -------------------------------------------------------------------- import os import sys from io import BytesIO, IOBase def solve(s): n=len(s) cnt=0 for i in range(n-3): if s[i]=='h' and s[i+1]=='a' and s...
output
1
81,983
6
163,967
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp came up with a new programming language. There are only two types of statements in it: * "x := s": assign the variable named x the value s (where s is a string). For example, the statement var := hello assigns the variable named...
instruction
0
81,984
6
163,968
Tags: data structures, hashing, implementation, matrices, strings Correct Solution: ``` t=int(input()) for _ in range(t): n=int(input()) d={} for i in range(n): s=input() if ':' in s: col=s.index(':') eq=s.index('=') st=s[0:col-1] d[s...
output
1
81,984
6
163,969
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp came up with a new programming language. There are only two types of statements in it: * "x := s": assign the variable named x the value s (where s is a string). For example, the statement var := hello assigns the variable named...
instruction
0
81,985
6
163,970
Tags: data structures, hashing, implementation, matrices, strings Correct Solution: ``` import time def main(): def cnt(s): ans = 0 for i in range(3, len(s)): if s[i - 3] == 'h' and s[i - 2] == 'a' and s[i - 1] == 'h' and s[i] == 'a': ans += 1 return ans de...
output
1
81,985
6
163,971
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp came up with a new programming language. There are only two types of statements in it: * "x := s": assign the variable named x the value s (where s is a string). For example, the statement var := hello assigns the variable named...
instruction
0
81,986
6
163,972
Tags: data structures, hashing, implementation, matrices, strings Correct Solution: ``` from collections import OrderedDict def find(s : str) -> int: # print(s) cnt = 0 for i in range(len(s)): if(i + 3 >= len(s)): break elif(s[i : i + 4] == "haha"): cnt += 1 retu...
output
1
81,986
6
163,973
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp came up with a new programming language. There are only two types of statements in it: * "x := s": assign the variable named x the value s (where s is a string). For example, the statement var := hello assigns the variable named...
instruction
0
81,987
6
163,974
Tags: data structures, hashing, implementation, matrices, strings Correct Solution: ``` #------------------------template--------------------------# import os import sys from math import * from collections import * # from fractions import * # from functools import * from heapq import * from bisect import * from io impo...
output
1
81,987
6
163,975
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp came up with a new programming language. There are only two types of statements in it: * "x := s": assign the variable named x the value s (where s is a string). For example, the statement var := hello assigns the variable named...
instruction
0
81,988
6
163,976
Tags: data structures, hashing, implementation, matrices, strings Correct Solution: ``` import sys input = sys.stdin.readline def im(): return map(int,input().split()) def ii(): return int(input()) def il(): return list(map(int,input().split())) def ins(): return input()[:-1] # s = 'a' # print(s[-3:]...
output
1
81,988
6
163,977
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp came up with a new programming language. There are only two types of statements in it: * "x := s": assign the variable named x the value s (where s is a string). For example, the statement var := hello assigns the variable named...
instruction
0
81,989
6
163,978
Tags: data structures, hashing, implementation, matrices, strings Correct Solution: ``` def f(a): b=0 for i in range(len(a)-3): if a[i]+a[i+1]+a[i+2]+a[i+3]=='haha': b+=1 return b for z in range(int(input())): b=[] b1=0 c=0 for y in range(int(input())): a=input()....
output
1
81,989
6
163,979
Provide tags and a correct Python 3 solution for this coding contest problem. Some dwarves that are finishing the StUDY (State University for Dwarven Youngsters) Bachelor courses, have been told "no genome, no degree". That means that all dwarves should write a thesis on genome. Dwarven genome is far from simple. It i...
instruction
0
81,998
6
163,996
Tags: implementation, strings Correct Solution: ``` s = input() t = input() print(['NO', 'YES'][sorted(s) == sorted(t) and sum([1 for i, j in zip(s, t) if i != j]) == 2]) ```
output
1
81,998
6
163,997
Provide tags and a correct Python 3 solution for this coding contest problem. Some dwarves that are finishing the StUDY (State University for Dwarven Youngsters) Bachelor courses, have been told "no genome, no degree". That means that all dwarves should write a thesis on genome. Dwarven genome is far from simple. It i...
instruction
0
81,999
6
163,998
Tags: implementation, strings Correct Solution: ``` s = input() t = input() if len(s)!=len(t): print('NO') else: mistakes = [] for i in range(len(s)): if s[i]!=t[i]: mistakes.append(i) if len(mistakes)==0: if len(set(s))==len(s): print('NO') else: ...
output
1
81,999
6
163,999
Provide tags and a correct Python 3 solution for this coding contest problem. Some dwarves that are finishing the StUDY (State University for Dwarven Youngsters) Bachelor courses, have been told "no genome, no degree". That means that all dwarves should write a thesis on genome. Dwarven genome is far from simple. It i...
instruction
0
82,000
6
164,000
Tags: implementation, strings Correct Solution: ``` def check(genomeA , genomeB): n = len(genomeA) m = len(genomeB) index = list() if n != m: return "NO" result = "YES" count = 0 if genomeA == genomeB: return result ...
output
1
82,000
6
164,001
Provide tags and a correct Python 3 solution for this coding contest problem. Some dwarves that are finishing the StUDY (State University for Dwarven Youngsters) Bachelor courses, have been told "no genome, no degree". That means that all dwarves should write a thesis on genome. Dwarven genome is far from simple. It i...
instruction
0
82,001
6
164,002
Tags: implementation, strings Correct Solution: ``` import collections s1 = input() s2 = input() c1 = collections.Counter(s1) c2 = collections.Counter(s2) c = 0 s1 = list(s1) s2 = list(s2) if(len(c1) == len(c2)): for i in c1: if c1[i] != c2[i]: print('NO') break else: ...
output
1
82,001
6
164,003
Provide tags and a correct Python 3 solution for this coding contest problem. Some dwarves that are finishing the StUDY (State University for Dwarven Youngsters) Bachelor courses, have been told "no genome, no degree". That means that all dwarves should write a thesis on genome. Dwarven genome is far from simple. It i...
instruction
0
82,002
6
164,004
Tags: implementation, strings Correct Solution: ``` s1=input() s2=input() if len(s1)!=len(s2): print("NO") else: lens1 = len(s1) s = [] ans = 0 for i in range(lens1): if s1[i] != s2[i]: ans += 1 s.append(list((s1[i], s2[i]))) if ans != 2: print('NO') e...
output
1
82,002
6
164,005
Provide tags and a correct Python 3 solution for this coding contest problem. Some dwarves that are finishing the StUDY (State University for Dwarven Youngsters) Bachelor courses, have been told "no genome, no degree". That means that all dwarves should write a thesis on genome. Dwarven genome is far from simple. It i...
instruction
0
82,003
6
164,006
Tags: implementation, strings Correct Solution: ``` s1 = input() s2 = input() if len(s1) != len(s2): print('NO') quit(0) if s1 == s2: print('YES') quit(0) l = len(s1) m = [] for k in range(l): if s1[k] != s2[k]: m.append(k) if len(m) != 2: print('NO') quit(0) if s1[m[0]] == s2[...
output
1
82,003
6
164,007
Provide tags and a correct Python 3 solution for this coding contest problem. Some dwarves that are finishing the StUDY (State University for Dwarven Youngsters) Bachelor courses, have been told "no genome, no degree". That means that all dwarves should write a thesis on genome. Dwarven genome is far from simple. It i...
instruction
0
82,004
6
164,008
Tags: implementation, strings Correct Solution: ``` s = input() st = input() d_1 = [] d_2 = [] l1 = len(s) l2 = len(st) if l1 != l2: print("NO") exit() for i in range(l1): if s[i] != st[i]: if len(d_1) + 1 > 2: print("NO") exit() d_1.append(s[i]) d_2.app...
output
1
82,004
6
164,009
Provide tags and a correct Python 3 solution for this coding contest problem. Some dwarves that are finishing the StUDY (State University for Dwarven Youngsters) Bachelor courses, have been told "no genome, no degree". That means that all dwarves should write a thesis on genome. Dwarven genome is far from simple. It i...
instruction
0
82,005
6
164,010
Tags: implementation, strings Correct Solution: ``` n=input() m=input() l=[] s="" if len(n)!=len(m): print("NO") exit() for x in range(len(n)): if n[x]!=m[x]: l.append(x) if len(l)>2: print("NO") exit() if len(l)==2: s=s+n[:l[0]]+n[l[1]]+n[l[0]+1:l[1]]+n[...
output
1
82,005
6
164,011
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Some dwarves that are finishing the StUDY (State University for Dwarven Youngsters) Bachelor courses, have been told "no genome, no degree". That means that all dwarves should write a thesis on ...
instruction
0
82,012
6
164,024
No
output
1
82,012
6
164,025
Provide tags and a correct Python 3 solution for this coding contest problem. Capitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word. Note, that during capitalization all the letters except the first one remains unchanged. Input A single line contains a...
instruction
0
82,031
6
164,062
Tags: implementation, strings Correct Solution: ``` L = input() P = L[0].upper() F = L[1:] G = P + F print (G) ```
output
1
82,031
6
164,063
Provide tags and a correct Python 3 solution for this coding contest problem. Capitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word. Note, that during capitalization all the letters except the first one remains unchanged. Input A single line contains a...
instruction
0
82,032
6
164,064
Tags: implementation, strings Correct Solution: ``` #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Sep 29 10:28:00 2020 @author: apple """ a=list(input()) a[0]=str.upper(a[0]) for i in range(0,len(a)): print(a[i],end='') ```
output
1
82,032
6
164,065
Provide tags and a correct Python 3 solution for this coding contest problem. Capitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word. Note, that during capitalization all the letters except the first one remains unchanged. Input A single line contains a...
instruction
0
82,033
6
164,066
Tags: implementation, strings Correct Solution: ``` word=input(); if word[0]>"Z": print(chr(ord(word[0])-32)+word[1:len(word)]); else: print(word); ```
output
1
82,033
6
164,067
Provide tags and a correct Python 3 solution for this coding contest problem. Capitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word. Note, that during capitalization all the letters except the first one remains unchanged. Input A single line contains a...
instruction
0
82,034
6
164,068
Tags: implementation, strings Correct Solution: ``` a=input() b=a[0].upper() print(a.replace(a[0],b,1)) ```
output
1
82,034
6
164,069
Provide tags and a correct Python 3 solution for this coding contest problem. Capitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word. Note, that during capitalization all the letters except the first one remains unchanged. Input A single line contains a...
instruction
0
82,035
6
164,070
Tags: implementation, strings Correct Solution: ``` def capitalize(c): if ord(c) >= 97 and ord(c) <= 122: return chr(ord(c) - 32) return c word = input() word_captitalized = "" first_word = True for c in word: if first_word: word_captitalized += capitalize(c) first_word = False ...
output
1
82,035
6
164,071
Provide tags and a correct Python 3 solution for this coding contest problem. Capitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word. Note, that during capitalization all the letters except the first one remains unchanged. Input A single line contains a...
instruction
0
82,036
6
164,072
Tags: implementation, strings Correct Solution: ``` x = input() a = x[1:] o = x.capitalize() w = o[0] + a print(w) ```
output
1
82,036
6
164,073
Provide tags and a correct Python 3 solution for this coding contest problem. Capitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word. Note, that during capitalization all the letters except the first one remains unchanged. Input A single line contains a...
instruction
0
82,037
6
164,074
Tags: implementation, strings Correct Solution: ``` def s(): stri = input() if ord(stri[0])>90: stri = chr(ord(stri[0])-32)+stri[1:] print(stri) s() ```
output
1
82,037
6
164,075
Provide tags and a correct Python 3 solution for this coding contest problem. Capitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word. Note, that during capitalization all the letters except the first one remains unchanged. Input A single line contains a...
instruction
0
82,038
6
164,076
Tags: implementation, strings Correct Solution: ``` import sys s=sys.stdin.readline().strip() print(s[0].upper()+s[1:]) ```
output
1
82,038
6
164,077
Provide tags and a correct Python 3 solution for this coding contest problem. You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q. For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo...
instruction
0
82,162
6
164,324
Tags: brute force, implementation, strings Correct Solution: ``` def calc(n, p, q, s): #pWords is number of words in p #qWords is number of words in q for totalPCharacters in range(0 , n+1, p): if (n - (totalPCharacters)) % q == 0: pWords = int(totalPCharacters / p) qWords = ...
output
1
82,162
6
164,325