Try something
This commit is contained in:
parent
21f447c67a
commit
b636b2ba14
1 changed files with 9 additions and 6 deletions
|
@ -1,14 +1,17 @@
|
||||||
strings = open("input.txt").read().split("\n")[:-1]
|
strings = open("input.txt").read().split("\n")[:-1]
|
||||||
nice = 0
|
nice = 0
|
||||||
for i in strings:
|
for i in strings:
|
||||||
|
pair = False
|
||||||
double = False
|
double = False
|
||||||
for j in range(len(i)-1):
|
for j in range(len(i)-1):
|
||||||
|
if not pair:
|
||||||
if i.count(f"{i[j]}{i[j+1]}") >= 2 and f"{i[j]}{i[j]}{i[j]}" not in i:
|
if i.count(f"{i[j]}{i[j+1]}") >= 2 and f"{i[j]}{i[j]}{i[j]}" not in i:
|
||||||
double = True
|
pair = True
|
||||||
break
|
if not double:
|
||||||
for j in range(len(i)):
|
|
||||||
f2 = i.find(i[j], j+1)
|
f2 = i.find(i[j], j+1)
|
||||||
if f2-j == 2 and double:
|
if f2-j == 2:
|
||||||
|
double = True
|
||||||
|
if pair and double:
|
||||||
nice+=1
|
nice+=1
|
||||||
break
|
break
|
||||||
print(nice)
|
print(nice)
|
||||||
|
|
Loading…
Reference in a new issue