way = gets.chomp.split("") sum = 1 i = 0 while i < way.size if way[i] == "L" sum *= 2 elsif way[i] == "R" sum = sum * 2 + 1 end i += 1 end puts sum