#!/usr/bin/ruby puts gets.to_i.times.map{|e| w=g=r=f=0 gets.chomp.chars{|c| if c=='R' r+=1 break if w