-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday01part01.py
More file actions
52 lines (49 loc) · 2.98 KB
/
Copy pathday01part01.py
File metadata and controls
52 lines (49 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Advent of Code - Day 1, Part 1
def input():
return "29917128875332952564321392569634257121244516819997569284938677239676779378"\
"82215832354983281441259781765124411785177125743867456725414655941952841146"\
"37812411598375767474165434519945796551753223973552555879354561856693345598"\
"82554936642122347526466965746273596321419312386992922582836979771421518356"\
"28553428582521279811315991127292344828468154465761665428563223595835586772"\
"24792522562923113847996696452938126911699367467448562277977795139973296632"\
"35176153745581296191298956836998758194274865327383988992499115472925731787"\
"22859262491182922198592593526878575785456913153876313342743484876747598917"\
"35796553751259724353593172377126676588287226238374487585283959816357469221"\
"44957695238318954845799697142491972626942976788997427135797297649149849739"\
"18682718577578625455286637172948994388127281746612927191224723656914171337"\
"74834693237373849678718769824764856583371838815192957286971214622662264522"\
"65259877781881868585356333494916519693683238733823362353424927852348119426"\
"67329479841631463779963634444894178277411314292531594766486934136335423538"\
"95978932115327457899575918986922531577265764888117694613549385755272734743"\
"99545366389515353657644736458182565245181653996192644851687269744491856672"\
"56388545787288336841563146969699475763628857581614692774717913318884114821"\
"28254538592696437361998368181215591985631224424835283168378858426962839327"\
"79475955796132242682934853291737434482287486978566652161245555856779844813"\
"28397945348922118933241231511757325953135287538444426445737315326387899933"\
"24441785771274338911642663877211163572782226657985848243369576484544266654"\
"95982221179382794158366894875864761266695773155813823291684611617853255857"\
"77442218598792121961859681444622955693835441716497179529474189863169857898"\
"92312453768263591792667837679359327888451435422935698639987732763658863756"\
"24694329228686284863341465994571635379257258559894197638117333711626435669"\
"41597625596741299413913138575182213492757893252146167753494532822813197329"\
"19621345235894911733436489644491497166967612184233147651682853427111371262"\
"39639867897341514131244859826663281981251614843274762372382114258543828157"\
"464392"
def main(input):
length = len(input)
position = 0
result = 0
if (input[0] is input[length-1]):
result = int(input[0])
for i in range(0, length):
if position+1 is length:
break
if input[i] is input[i+1]:
result = result + int(input[i])
position = position + 1
print result
if __name__ == '__main__':
"""
Run the application with the input string.
"""
main(input())