s = gets.chomp + gets.chomp s = s.split("x").uniq.sort p s[0] ? s[-1].length : 0