l=r=0 gets.scan(?(){$_=$' ~/\^.*?\^.*?\*/&&l+=$'.count(?)) ~/\*.*?\^.*?\^/&&r+=$'.count(?))} print l," ",r