King Charles III has been diagnosed with a form of cancer and has begun treatment, Buckingham Palace says.