class A def initialize s = gets.chomp.chars number = 1 s.each do |ch| if ch == 'R' number = 2 * number + 1 else number = 2 * number end end puts number end end A.new