Fife Council is to invest £19.5 million into battling flooding caused by climate change over the next decade.