-
Notifications
You must be signed in to change notification settings - Fork 0
/
04-a.ldpl
53 lines (43 loc) · 1.02 KB
/
04-a.ldpl
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
53
data:
auxText is text
range is text list
from is number
to is number
pass is number
passText is text
i is number
adjacent is number
decrease is number
digit0 is number
digit1 is number
count is number
procedure:
load file "04.txt" in auxText
split auxText by "-" in range
store range:0 in from
trim range:1 in range:1
store range:1 in to
in to solve to + 1
for pass from from to to step 1 do
store pass in passText
store 0 in adjacent
store 0 in decrease
store 0 in i
while i is less than 5 do
get character at i from passText in auxText
store auxText in digit0
in i solve i + 1
get character at i from passText in auxText
store auxText in digit1
if digit0 is equal to digit1 then
store 1 in adjacent
end if
if digit0 is greater than digit1 then
store 1 in decrease
end if
repeat
if adjacent is equal to 1 and decrease is equal to 0 then
in count solve count + 1
end if
repeat
display count crlf