Maximum cuts of graphs with forbidden cycles