Please clink https://www.google.com/maps/@51.7137861,-4.4887064,62017m/data=!3m1!1e3!5m1!1e1 which will show part of south-west Wales.
It sounds like you wish to do some hiking of the coast. You will see the Gower peninsula sticking out west of Swansea. Suggest you take a bus from Swansea to Rhossili at the western tip and find accomodation for a night or 2. The coast here is stunning. A good hike would be to walk eastward along the south Gower coast. How far east you go is up to you but if you can get as far as Oxwich that would be good. Zoom down on the map for some guidance.
Now go back to original map and look for Tenby. The south Pembrokeshire coast is also stunning west of Tenby. If you can get a bus to Penally (or walk along the beach from Tenby) to Skrinkle Haven (Youth Hostel here called ‘Manorbier’ even though it is not in Manorbier village - would be a good cheap place to stay) and then on to Manorbier village (where you could stay in the castle if you have the money) - that would be another good bit. From Pembroke - bus to Bosherston and walk along the ‘lily’ pools to the beach at Broadhaven south and then E to beautiful Barafundle Bay. Please note that much of the coast west of Bosherston is in an army range and usually closed to the public. (Manorbier rail station is a fair old way from the village and youth hostel).
The coast is also good near St.David’s. If you zoom down on the bits mentioned and pull out the yellow man and place him on the coast path, you will see that Google have walked the route with a camera so you can see what to expect should you visit.
I would not stay 10 nights in Cardiff. If you have surplus time in Cardiff, a good day trip would be train east to Chepstow (castle) and then local bus up the Wye Valley to see the ruins of Tintern Abbey.
The coast near Aberystwyth is not the best - forget the idea of walking it in this area. 5 nights in Aberystwyth is too long. You need to establish a base in the north-west for seeing/hiking Snowdonia. I suggested Porthmadog but also consider Caernarvon as these have buses into the hinterland.
You do not need to get back to Cardiff to return to London of that is your intention. Trains go from Aberystwyth or Porthmadog via Machynlleth to Birmingham which has fast trains to London (Euston). If in the north, direct trains go from Bangor & Llandudno Junction to London (Euston) or Transport for Wales Trains to Chester & then change for London train. Transport for Wales also have direct trains from Cardiff to north Wales via Shrewsbury (worth a look) and Chester to Llandudno Junction, Bangor & Holyhead. Long distance trains are much cheaper if pre-booked for a specific train. Even booking the day before will usually get a cheaper ticket than pay on the day. Pay on the day is OK for short hops.
Don't assume that all of the Wales Coast Path train is scenic. Some of it goes through industrial areas such as Port Talbot. You need to pick the best bits! https://www.walescoastpath.gov.uk/?lang=en
Bus stops are clearly marked and it should be obvious which side of the road you stand for each direction. You can also ways confirm with a local.
The Fflecsi bus service is available over much of rural Wales. See also:>
https://www.visitpembrokeshire.com/explore-pembrokeshire/getting-around
For Snowdonia:> https://snowdonexperts.uk/snowdon-sherpa-bus/