Railway Berth Allocation Validator
Railway Berth Allocation Validator
MediumStrings0% accepted
At Delhi railway station, Kumar is booking tickets. Each berth allocation is encoded as 'Coach-BerthNumber-BerthType' (U/L/M for Upper/Lower/Middle). Validate if the allocation string follows the correct format.
Approach
Given a berth allocation string in format 'A-5-U', validate if coach is a letter, berth is numeric, and type is U/L/M.
Input
A-5-U
Output
Valid
More Strings problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards