William and Kate have toured parts of Wales recently affected by flooding ahead of St David's Day celebrations, taking part in a Welsh cake-making challenge.