Dataweave Code Mulesoft

Can you write dataweave code to generate the output from the incoming input, as show below (no hard coding).