Extract Region Code from Voter ID
Extract Region Code from Voter ID
EasyStrings0% accepted
Meera works at the Election Commission's Delhi office. Voter IDs follow format 'VS12AB34567' where 'VS' is state code, positions 2-3 are district code. Extract the district code from voter IDs for region-wise analysis.
Approach
Given a voter ID string formatted as 'STXXYYYYYY' (2 state letters, 2 district letters, 6 digits), extract the 2-character district code.
Input
VS12AB34567
Output
AB
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