s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s393551043
p02247
u138194441
1597564621
Python
Python3
py
Accepted
20
5572
108
X = input() Y = input() x = len(X) y = len(Y) for i in range(x-y+1): if Y == X[i:i+y]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,282
s079478647
p02247
u419548414
1597511307
Python
Python3
py
Accepted
20
5572
109
t= input() p= input() l= len(p) for i in range(len(t) - l + 1) : if t[i : i + l] == p: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,283
s782827027
p02247
u179629761
1597487308
Python
Python3
py
Accepted
20
5564
141
s = input() target = input() index = -1 while True: index = s.find(target, index + 1) if index == -1: break print(index)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,284
s902040465
p02247
u257570657
1597486069
Python
Python3
py
Accepted
20
5568
122
t=str(input()) p=str(input()) a=int(0) for i in range(len(t)): f=t[i:i+len(p)] if f.find(p)!=-1: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,285
s915138488
p02247
u343395327
1597467960
Python
Python3
py
Accepted
40
6804
2,713
import string class SuffixArray: def __init__(self, S): self.N = len(S) self.S = S self.atoi = {x: i for i, x in enumerate(string.printable)} self.sa = self.__make_sa() def show(self): for i, s in enumerate(self.sa): print(i, s, self.S[s:]) def __make_...
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,286
s871882996
p02247
u355413291
1597459681
Python
Python3
py
Accepted
20
5572
103
T = input() P = input() for i in range(len(T)-len(P)+1): if T[i:i+len(P)] == P: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,287
s902092158
p02247
u413645175
1597456078
Python
Python3
py
Accepted
20
5568
107
T = input() P = input() for i in range(len(T) - len(P) + 1): if P == T[i : i + len(P)]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,288
s916716501
p02247
u695568874
1597416152
Python
Python3
py
Accepted
40
5580
234
n=str(input()) a=len(n) N=list(n) m=str(input()) A=len(m) x=0 for i in range(a-A+1): C=[] for j in range(A): C.append(N[j]) B=''.join(C) c=N[0] if B==m: print(i) N.remove(c) N.append(c)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,289
s247822371
p02247
u880802684
1597386262
Python
Python3
py
Accepted
20
5576
139
t = input() p = input() t_len = len(t) p_len = len(p) for i in range(0, t_len - p_len + 1): if t[i:i + p_len] == p: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,290
s757688141
p02247
u278236319
1597214217
Python
Python3
py
Accepted
20
5564
90
a=input() b=input() for i in range (len(a)): if b == a[i:i+len(b)]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,291
s897790060
p02247
u737337423
1596994492
Python
Python3
py
Accepted
20
5572
185
T = input() P = input() lt = len(T) rp = tuple(range(len(P))) for i in range(lt): for j in rp: if i+j >= lt or T[i+j] != P[j]: break else: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,292
s006078042
p02247
u574841425
1596898003
Python
Python3
py
Accepted
40
6716
750
from pprint import pprint __BASE = 1000000007 __MOD = (2**64) __INV = 13499267949257065399 def main(): s,t = input(),input() x = len(t) mp = {} hashv = 0 for i in range(len(s)): if i - x >= 0: hashv = hashv - ord(s[i-x]) * ( __BASE ** (x-1) ) hashv *= __BA...
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,293
s303712862
p02247
u900012957
1596776257
Python
Python3
py
Accepted
20
5564
93
T = input() P = input() for i in range(len(T)): if T[i:].startswith(P): print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,294
s444549529
p02247
u329155726
1596692157
Python
Python3
py
Accepted
20
5576
99
A=input() B=input() a=len(A) b=len(B) for i in range (a-b+1): if B==A[i:i+b]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,295
s159825511
p02247
u996694149
1596691805
Python
Python3
py
Accepted
20
5564
132
T = input() P = input() index = -1 while True: index = T.find(P,index + 1) if index == -1: break print(index)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,296
s800452901
p02247
u573698742
1596528162
Python
Python3
py
Accepted
20
5564
89
T=input() P=input() for i in range(len(T)): if T[i:].startswith(P): print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,297
s097314660
p02247
u512192552
1596517951
Python
Python3
py
Accepted
20
5568
121
# coding: utf-8 # Your code here! T=input() P=input() for i in range(len(T)): if P==T[i:i+len(P)]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,298
s931247163
p02247
u799752967
1596504667
Python
Python3
py
Accepted
20
5568
89
T,P=input(),input() for i in range(len(T)): if T[i:].startswith(P): print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,299
s973119960
p02247
u884758681
1596504157
Python
Python3
py
Accepted
20
5568
79
T=input() P=input() for i in range (len(T)): P!=T[i:i+len(P)] or print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,300
s542883120
p02247
u413704014
1596441448
Python
Python3
py
Accepted
20
5572
132
T = input() P = input() index = -1 while True: index = T.find(P, index + 1) if index == -1: break print(index)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,301
s160093036
p02247
u528181593
1596441423
Python
Python3
py
Accepted
20
5576
103
s=input() a=len(s) p=input() b=len(p) for i in range (a): l=s[i:i+b] if l==p: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,302
s796226728
p02247
u167524059
1596427462
Python
Python3
py
Accepted
20
5576
296
a = list(input()) b = list(input()) for j in range(len(a)+1-len(b)) : Same = True ans = j i = 0 while i < len(b) : if b[i] == a[j] : i += 1 j += 1 else : Same = False break if Same == True : print(ans)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,303
s054476673
p02247
u514242733
1596384673
Python
Python3
py
Accepted
20
5568
87
n=input() m=input() for i in range(len(n)): if n[i:i+len(m)]==m: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,304
s838586115
p02247
u189528630
1596037118
Python
Python3
py
Accepted
20
5564
127
a = input() b = input() x = 0 while True: x = a.find(b, x) if x+1: print(x) else: break x += 1
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,305
s504516913
p02247
u497248335
1596035006
Python
Python3
py
Accepted
20
5564
123
T=input() P=input() m=-1 for i in range(len(T)): k=T.find(P,i,len(T)) if m != k and k>=0: print(k) m=k
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,306
s923650910
p02247
u677563181
1595997777
Python
Python3
py
Accepted
20
5568
93
T, P = input(), input() for i in range(len(T)): if T[i:].startswith(P): print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,307
s043150945
p02247
u918533241
1595900303
Python
Python3
py
Accepted
20
5564
180
T=input() P=input() a=T.find(P) if a>=0: print(a) while True: b=T.find(P,a+1) if b>=0: print(b) if b==-1: break a=b
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,308
s410056731
p02247
u275486335
1595900169
Python
Python3
py
Accepted
50
5572
186
a=input() b=input() x=list(a) y=list(b) for i in range(len(a)+1-len(b)): z=0 for j in range(len(b)): if x[i+j]==y[j]: z+=1 if z==len(b): print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,309
s117215792
p02247
u869208015
1595825332
Python
Python3
py
Accepted
20
5572
119
t=input() p=input() for i in range(len(t)-len(p)+1): if t[i:i+len(p)]==p: print(i) else: pass
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,310
s132160047
p02247
u361745995
1595692620
Python
Python3
py
Accepted
20
5564
144
t=input() p=input() l=len(t) ll=len(p) i=0 for i in range(l-ll+1): x=t.find(p,i,i+ll) if x==-1: pass else: print(x)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,311
s577874317
p02247
u251716708
1595606782
Python
Python3
py
Accepted
30
5576
157
A = input() B = input() a = len(A) b = len(B) for i in range(a-b+1): if B == A[i:i+b]: #a[i:j]→[a[i], a[i+1], a[i+2], ..., a[j-1]] print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,312
s768239904
p02247
u333382219
1595570884
Python
Python3
py
Accepted
20
5560
87
T = input() P = input() for i in range(len(T)): if T[i:].startswith(P): print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,313
s292362946
p02247
u633358233
1595563804
Python
Python3
py
Accepted
20
5568
105
a=input() b=input() for i in range(len(a)): x=a[i:i+len(b)].find(b) if x!=-1: print(x+i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,314
s912613104
p02247
u635020217
1595500263
Python
Python3
py
Accepted
20
5568
140
# coding: utf-8 # Your code here! t = str(input()) p = str(input()) for i in range(len(t)): if t[i:].startswith(p): print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,315
s597244450
p02247
u511744190
1595400947
Python
Python3
py
Accepted
20
5568
99
A=input() B=input() a=len(A) b=len(B) for i in range (a-b+1): if B==A[i:i+b]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,316
s528090907
p02247
u397004753
1595300299
Python
Python3
py
Accepted
20
5572
108
t = input() p = input() tl = len(t) pl = len(p) for i in range (tl-pl+1): if p == t[i:i+pl]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,317
s158868157
p02247
u976648183
1595293527
Python
Python3
py
Accepted
20
5580
133
T, P = [input() for i in range(2)] len_P = len(P) for i in range(len(T) - len_P + 1): if P == T[i:i + len_P]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,318
s974520055
p02247
u053015104
1595241904
Python
Python3
py
Accepted
20
5576
159
t_str = input() p_str = input() for i in range(len(t_str) - len(p_str) + 1): if t_str[i:i + len(p_str)] == p_str: print(i) else: pass
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,319
s784520942
p02247
u644959375
1595230424
Python
Python3
py
Accepted
20
5572
86
T=input() P=input() for i in range(len(T)): if T[i:i+len(P)]==P: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,320
s722267992
p02247
u442912414
1595224962
Python
Python3
py
Accepted
20
5576
176
# coding: utf-8 # Your code here! #59 文字列の検索 t=str(input()) p=str(input()) x=0 while True: a=t.find(p, x) if a==-1: break print(a) x=a+1
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,321
s534490826
p02247
u711365732
1595211043
Python
Python3
py
Accepted
20
5564
115
T = input() P = input() for i in range(len(T)): if P in T[i:i+len(P)]: print(i) else: pass
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,322
s685140957
p02247
u555228137
1595183131
Python
Python3
py
Accepted
20
5568
105
T=str(input()) P=str(input()) for i in range(len(T)+1-len(P)): if T[i:i+len(P)]==P: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,323
s004628961
p02247
u259416836
1595143196
Python
Python3
py
Accepted
20
5580
175
t=input() p=input() try: if t.count(p)!=0: for i in range(len(t)-len(p)+1): if p==t[i:i+len(p)]: print(i) except: pass
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,324
s840722933
p02247
u630948380
1595142316
Python
Python3
py
Accepted
70
5576
180
C='' T=list(str(input())) P=str(input()) for i in range(len(T)-len(P)+1): for j in range(len(P)): C+=T[i+j] j+=1 if C==P: print(i) C=''
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,325
s615966933
p02247
u350481745
1594949143
Python
Python3
py
Accepted
20
5576
132
T=input() P=input() for i in range(len(T)-len(P)+1): if P[0:len(P)]==T[i:i+len(P)]: print(i) else: continue
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,326
s092510347
p02247
u272062354
1594832121
Python
Python3
py
Accepted
20
5568
124
T=input() P=input() t=len(T) p=len(P) for i in range(t): x=T.find(P,i,i+p) if x!=(-1): print(x)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,327
s383254586
p02247
u919773430
1594621298
Python
Python3
py
Accepted
20
5572
105
t=input() p=input() for i in range(len(t)): x=t[i:i+len(p)].find(p) if x!=-1: print(x+i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,328
s317363808
p02247
u926092389
1594534264
Python
Python3
py
Accepted
20
5572
99
t=input() p=input() s=len(t)-len(p) for i in range(s+1): if p==t[i:len(p)+i]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,329
s368060583
p02247
u286677087
1594481310
Python
Python3
py
Accepted
30
5584
172
t = input() p = input() for i in range(len(t)-len(p)+1): if t[i] == p[0]: if all(t[i+j] == p[j] for j in range(len(p)) if i+j < len(t)): print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,330
s816120941
p02247
u221550784
1594080423
Python
Python3
py
Accepted
20
5568
146
T=input() P=input() l1=len(T) l2=len(P) i=0 for i in range(l1-l2+1): x=T.find(P,i,i+l2) if x==-1: pass else: print(x)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,331
s963945161
p02247
u037263780
1594043745
Python
Python3
py
Accepted
20
5572
142
T=str(input()) P=str(input()) t=list(T) p=list(P) for i in range(len(t)-len(p)+1): S=''.join(t[i:i+len(p)]) if S==P: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,332
s657834650
p02247
u596129030
1594027471
Python
Python3
py
Accepted
20
5572
217
s=input() t=input() v=0 for i in range(len(s)): u=s.find(t) s=s[u+1:] if u==-1: break else: print(u+v) v=v+u+1
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,333
s997665241
p02247
u826807985
1594024605
Python
Python3
py
Accepted
20
5572
105
T = input() P = input() x = len(T) i = 0 for i in range(x): if T[i:].startswith(P): print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,334
s895792596
p02247
u371026526
1594022399
Python
Python3
py
Accepted
30
5564
98
t = input() p = input() for i in range(len(t)-len(p)+1): if t.find(p,i,i+len(p)) != -1: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,335
s461725446
p02247
u838993229
1594022122
Python
Python3
py
Accepted
20
5576
179
T = str(input()) P = str(input()) results = [] for i in range(len(T) - len(P) + 1): x = T[i:i+len(P)] if x == P: results.append(i) for r in results: print(r)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,336
s706249424
p02247
u444626963
1594017231
Python
Python3
py
Accepted
20
5568
112
a= input() b= input() ln = len(b) for i in range(len(a) - ln + 1): if a[i : i + ln] == b : print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,337
s921209771
p02247
u931484744
1594014570
Python
Python3
py
Accepted
20
5576
142
# coding: utf-8 # Your code here! T = input() P = input() for i in range(len(T) - len(P) + 1): if P == T[i : i + len(P)]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,338
s913232021
p02247
u874049078
1594014004
Python
Python3
py
Accepted
20
5580
234
#59 文字列検索 T = input().upper() P = input().upper() results = [] for i in range(len(T) - len(P) + 1): temp = T[i:i+len(P)] if temp == P: results.append(i) for r in results: print(r)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,339
s915596505
p02247
u511292942
1594002660
Python
Python3
py
Accepted
20
5564
120
t = input() p = input() a = 0 while True: b = t.find(p, a) if b == -1: break print(b) a = b + 1
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,340
s533288791
p02247
u991830357
1593758441
Python
Python3
py
Accepted
20
5564
123
T=input() P=input() m=-1 for i in range(len(T)): k=T.find(P,i,len(T)) if m != k and k>=0: print(k) m=k
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,341
s187110814
p02247
u140569607
1593447682
Python
Python3
py
Accepted
30
5568
116
T = input() P = input() t = len(T) p = len(P) for i in range(t - p + 1): if T[i : i + p] == P: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,342
s846993226
p02247
u904289400
1593415229
Python
Python3
py
Accepted
20
5572
99
T=input() P=input() t=len(T) p=len(P) for i in range(t-p+1): if P==T[i:i+p]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,343
s425677073
p02247
u206985725
1593411035
Python
Python3
py
Accepted
20
5576
153
t=input() p=input() for i in range(len(t)): x=0 x=t[i:i+len(p)].find(p) #print(t[i:i+2]) if x!=-1: # print(x) print(x+i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,344
s468593052
p02247
u435414815
1593407142
Python
Python3
py
Accepted
20
5576
96
s=input() l=input() for i in range(len(s)-len(l)+1): if l==s[i:i+len(l)]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,345
s545717768
p02247
u973203074
1593353704
Python
Python3
py
Accepted
20
5584
133
T, P = [input() for i in range(2)] len_P = len(P) for i in range(len(T) - len_P + 1): if P == T[i:i + len_P]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,346
s373970585
p02247
u260980560
1593341464
Python
Python3
py
Accepted
20
5584
1,103
import sys readline = sys.stdin.readline write = sys.stdout.write class KMP: def __init__(self, W): L = len(W) T = [0] * (L+1) T[0] = -1 c = 0 for p in range(1, L): if W[p] == W[c]: T[p] = T[c] else: T[p] = c ...
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,347
s473099437
p02247
u695386605
1593329960
Python
Python3
py
Accepted
20
5564
141
T = str(input()) P = str(input()) x = 0 while True: x = T.find(P, x) if x+1: print(x) else: break x = x + 1
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,348
s808712050
p02247
u171326376
1593223193
Python
Python3
py
Accepted
20
5568
120
t = input() p = input() b = 0 while True: a = t.find(p, b) if a == -1: break print(a) b = a + 1
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,349
s119686284
p02247
u208167569
1593094229
Python
Python3
py
Accepted
20
5572
116
T = input() P = input() len_P = len(P) for i in range(len(T)-len_P+1): if T[i:i+len_P] == P: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,350
s814446540
p02247
u057249340
1592963684
Python
Python3
py
Accepted
20
5572
110
a = input() b = input() for i in range(len(a)-len(b)+1): x = a[i:i+len(b)] if x==b: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,351
s770440214
p02247
u795882061
1592665829
Python
Python3
py
Accepted
20
5560
93
T = input() P = input() for i in range(len(T)): if T[i:].startswith(P): print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,352
s838865086
p02247
u390052013
1592527178
Python
Python3
py
Accepted
20
5572
183
def resolve(): T = input() P = input() idx = 0 while idx <= len(T) - len(P): if T[idx:idx + len(P)] == P: print(idx) idx += 1 resolve()
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,353
s221497052
p02247
u177648086
1592417815
Python
Python3
py
Accepted
20
5572
109
t=input() p=input() a=0 while True: a=t.find(p, a) if a == -1: break print(a) a += 1
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,354
s516363913
p02247
u173393391
1592202996
Python
Python3
py
Accepted
20
5572
95
t=input() p=input() l=len(p) for i in range(len(t)-l+1): if p==t[i:i+l]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,355
s994714211
p02247
u470391435
1592186294
Python
Python3
py
Accepted
20
5564
93
T = input() P = input() for j in range(len(T)): if T[j:].startswith(P): print(j)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,356
s375000939
p02247
u240091169
1591942088
Python
Python3
py
Accepted
20
5572
296
a = list(input()) b = list(input()) for j in range(len(a)+1-len(b)) : Same = True ans = j i = 0 while i < len(b) : if b[i] == a[j] : i += 1 j += 1 else : Same = False break if Same == True : print(ans)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,357
s517626885
p02247
u512884261
1591885595
Python
Python3
py
Accepted
30
5964
574
import sys, collections input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) INF = 10**10 def I(): return int(input()) def F(): return float(input()) def SS(): return input() def LI(): return [int(x) for x in input().split()] def LI_(): return [int(x)-1 for x in input().split()] def LF(): return ...
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,358
s542302725
p02247
u988962397
1591847006
Python
Python3
py
Accepted
20
5572
91
t=input() p=input() for i in range(len(t)): if p in t[i:i+len(p)]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,359
s882352093
p02247
u753534330
1591708087
Python
Python3
py
Accepted
50
5568
329
t = str(input()) p = str(input()) tt = len(t) pp = len(p) y = 0 #print(t, p) for i in range(tt - pp + 1): x = 0 for j in range(pp): #print(i, j, t[i+j], p[j]) if t[i+j] == p[j]: x = x + 1 #print(x) if x == pp: y = y + 1 #print('→',i) pr...
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,360
s738734083
p02247
u647921435
1591664202
Python
Python3
py
Accepted
20
5568
146
T=input() P=input() l1=len(T) l2=len(P) i=0 for i in range(l1-l2+1): x=T.find(P,i,i+l2) if x==-1: pass else: print(x)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,361
s728499058
p02247
u862272701
1591626028
Python
Python3
py
Accepted
20
5564
120
T = str(input()) P = str(input()) x = -1 while True: x = T.find(P, x+1) if x == -1: break print(x)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,362
s294304557
p02247
u253463111
1591597299
Python
Python3
py
Accepted
20
5564
139
a = input() b = input() idx = 0 while True: idx = a.find(b, idx) if idx+1: print(idx) else: break idx += 1
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,363
s335371918
p02247
u228556128
1591099213
Python
Python3
py
Accepted
30
5572
209
lst1=list(input()) lst2=list(input()) l=[] for i in range(len(lst1)-len(lst2)+1): if str(lst1[i:i+len(lst2)])==str(lst2): l.append(i) else: pass for i in range(len(l)): print(l[i])
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,364
s981019821
p02247
u895962529
1591019201
Python
Python3
py
Accepted
20
5568
90
T=input() P=input() for i in range(len(T)): if T[i:].startswith(P): print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,365
s503449329
p02247
u192469946
1590744347
Python
Python3
py
Accepted
40
6460
136
#1_14_A import re t = input() p = input() idx = -1 while True: idx = t.find(p,idx+1) if idx == -1: break print(idx)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,366
s688466124
p02247
u290304811
1590670465
Python
Python3
py
Accepted
30
5568
112
t = input() p = input() for i in range(len(t)-len(p)+1): a = t[i:i+len(p)] if a==p: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,367
s619260438
p02247
u128671689
1590668966
Python
Python3
py
Accepted
20
5572
169
T=str(input()) P=str(input()) l1=len(T) l2=len(P) i=0 for i in range(l1-l2+1): i+=1 x=T.find(P,i-1,i+l2-1) if x==-1: pass else: print(x)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,368
s115722271
p02247
u994684803
1590660445
Python
Python3
py
Accepted
20
5568
129
t = input() p = input() for i in range(len(t) - len(p) + 1): if t[i:i + len(p)] == p: print(i) else: pass
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,369
s498300009
p02247
u705625724
1590591588
Python
Python3
py
Accepted
20
5584
261
# coding: utf-8 # 59 T = input() P = input() t=[] A = [] #print(len(P),len(T)) if len(P)==1: K=len(T) else: K = len(T)-(len(P)-1) #print(K) p = len(P) for i in range(K): t = T[i:p] #print(t) p += 1 if t.count(P)>0: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,370
s006003365
p02247
u395654950
1590396605
Python
Python3
py
Accepted
20
5576
143
# coding: utf-8 # Your code here! T = input() P = input() for i in range(len(T) - len(P) + 1): if P == T[i : i + len(P)]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,371
s354550783
p02247
u747915832
1589902446
Python
Python3
py
Accepted
20
5576
538
while True: try: T = input() P = input() Tlen = len(T) Plen = len(P) except Plen>Tlen: break count = 0 List = [] for i in range(Tlen-Plen+1): index = T.find(P) if index==0: List.append(count) Tlist = lis...
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,372
s651600894
p02247
u583329397
1589630729
Python
Python3
py
Accepted
20
5568
105
T=str(input()) P=str(input()) for i in range(len(T)): if T[i:len(T)].startswith(P): print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,373
s086594595
p02247
u814278309
1589553786
Python
Python3
py
Accepted
20
5572
130
t = input() p = input() for i in range(len(t) - len(p) + 1): if t[i:i + len(p)] == p: print(i) else: pass
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,374
s287276729
p02247
u815830103
1589440878
Python
Python3
py
Accepted
20
5576
273
def comp(T,P): if T == P: return True else: return False def main(): T = input() P = input() n1,n2 = len(T),len(P) for i in range(n1-n2+1): if comp(T[i:i+n2],P): print(i) if __name__ == "__main__": main()
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,375
s076775518
p02247
u350963229
1589273610
Python
Python3
py
Accepted
20
5568
90
t=input() p=input() for i in range(len(t)): if p == t[i:i+len(p)]: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,376
s861072528
p02247
u014861569
1588845508
Python
Python3
py
Accepted
20
5568
89
s=input() p=input() for i in range(len(s)): if s[i:].startswith(p): print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,377
s736470680
p02247
u713172874
1588123417
Python
Python3
py
Accepted
60
5576
284
T = input() P = input() if len(P) > len(T): pass else: p = len(P) ans = [] for i in range(len(T)-len(P)+1): tmp = "" for j in range(i,i+p): tmp += T[j] if tmp == P: ans.append(i) for i in ans: print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,378
s029981561
p02247
u037441960
1588086461
Python
Python3
py
Accepted
20
5572
113
T = input() P = input() l = len(P) for i in range(len(T) - l + 1) : if T[i : i + l] == P : print(i)
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,379
s439691608
p02247
u838900850
1586103669
Python
Python3
py
Accepted
20
5572
162
def main(): s = input() t = input() for i in range(len(s)-len(t)+1): if t == s[i:i+len(t)]:print(i) if __name__ == '__main__': main()
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,380
s858643921
p02247
u820842907
1586016025
Python
Python3
py
Accepted
20
5572
158
def Main(): text = input() pattern = input() for i in range(len(text)): if text[i:].startswith(pattern): print(i) Main()
p02247
<H1>Naive String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a ...
aabaaa aa
0 3 4
30,381