blob: 51fc9f6e50267af2458c4726495afd13c103b3c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/usr/bin/ruby
#
# See ../README.md
#
#
# Run as: ruby ch-1.rb < input-file
#
ARGF . each_line do
|line|
num = line . to_i
puts ( (num & 0x55) << 1 \
| (num & 0xAA) >> 1)
end
|