A Babel of Languages on CodinGame
TBali
61K views
Ruby
Checking the sample code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#m = gets.chomp
m = "CG"
b = ""
m.each_byte { |w|
b += ('%7.7s' % w.ord.to_s(2)).gsub(' ', '0')
}
c = ["00", "0"]
ans = c[b[0].to_i] + " 0"
for i in 1..b.length-1
ans += (b[i] == b[i - 1] ? "0" : " " + c[b[i].to_i] + " 0")
end
# STDERR.puts "Debug messages..."
print ans
Looking at the syntax
- TODO
Other characteristics
- TODO
- Ruby excels at Code Golf. You can write really short code in it.
Resources to check
Coming next...
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Suggested playgrounds