puts "%d %d" % gets.chomp.gsub(/^\(|\)?#/,"").split(")(").inject([0,0]){|s,e| e[0]=="^" ? [s[0]+1,s[1]] : [s[0],s[1]+1]}