aboutsummaryrefslogtreecommitdiff
path: root/challenge-139/abigail/ruby/ch-1.rb
blob: b3d4bbe72049bce9337a669e8888ed60b87920d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/ruby

#
# See ../README.md
#
 
#
# Run as: ruby ch-1.rb < input-file
#

ARGF . each_line do
    | line |
    sorted = 1
    list = line . strip() . split(" ")
    list . map . with_index do
        | _, i |
        if i > 0 && list [i - 1] > list [i] then
            sorted = 0
        end
    end
    puts (sorted)
end