Solved 2017/09 part 2
This commit is contained in:
parent
ef196af7e3
commit
4cc516a620
12
2017/09/9.md
12
2017/09/9.md
@ -72,8 +72,6 @@ group that immediately contains it. (The outermost group gets a score of
|
|||||||
|
|
||||||
Your puzzle answer was `11898`.
|
Your puzzle answer was `11898`.
|
||||||
|
|
||||||
The first half of this puzzle is complete! It provides one gold star: \*
|
|
||||||
|
|
||||||
## \-\-- Part Two \-\-- {#part2}
|
## \-\-- Part Two \-\-- {#part2}
|
||||||
|
|
||||||
Now, you\'re ready to remove the garbage.
|
Now, you\'re ready to remove the garbage.
|
||||||
@ -93,7 +91,13 @@ nor do any canceled characters or the `!` doing the canceling.
|
|||||||
*How many non-canceled characters are within the garbage* in your puzzle
|
*How many non-canceled characters are within the garbage* in your puzzle
|
||||||
input?
|
input?
|
||||||
|
|
||||||
Answer:
|
Your puzzle answer was `5601`.
|
||||||
|
|
||||||
Although it hasn\'t changed, you can still [get your puzzle
|
Both parts of this puzzle are complete! They provide two gold stars:
|
||||||
|
\*\*
|
||||||
|
|
||||||
|
At this point, you should [return to your Advent calendar](/2017) and
|
||||||
|
try another puzzle.
|
||||||
|
|
||||||
|
If you still want to see it, you can [get your puzzle
|
||||||
input](9/input).
|
input](9/input).
|
||||||
|
@ -35,11 +35,12 @@ if part == 1:
|
|||||||
if part == 2:
|
if part == 2:
|
||||||
with open(input_f) as file:
|
with open(input_f) as file:
|
||||||
for line in file:
|
for line in file:
|
||||||
print(line.rstrip(), end=' ')
|
#print(line.rstrip(), end=' ')
|
||||||
|
length = 0
|
||||||
clean_string = line.rstrip()
|
clean_string = line.rstrip()
|
||||||
clean_string = re.sub(r"!.",'',clean_string)
|
clean_string = re.sub(r"!.",'',clean_string)
|
||||||
print(clean_string)
|
clean_string = re.findall(r"<(.*?)>", clean_string)
|
||||||
clean_string = re.findall(r"<.*?>", clean_string)
|
|
||||||
for c in clean_string:
|
for i in clean_string:
|
||||||
clean_string = c.replace('<','',1).replace('>','',1)
|
length += len(i)
|
||||||
print(len(clean_string))
|
print(length)
|
||||||
|
Loading…
Reference in New Issue
Block a user