In my opinion:
1st day - Explore Bratislava Old Town and the Danube Promenade.
2nd day - Visit Bratislava Castle and Devin Castle (20 minutes outside of Bratislava).
You can also spend more time in Bratislava and use it as a transport hub:
3rd day - Take a boat trip to Vienna and return by evening train. (1.5h one way)
4th day - Take a trip to Budapest by train, boat, or car. (2.5h one way)
Here you can check how it looks like? Watch and prepare for a trip
https://youtube.com/playlist?list=PLlLSZde8kP9XjLN6EOwKfz0lENdDpLxvX&si=s7O0La8DDlc96iUZ