⌘K
Flycodx

Parse Blood Donation Inventory Codes

Parse Blood Donation Inventory Codes

EasyStrings0% accepted

A blood bank in Delhi maintains inventory with standardized codes like 'O+_2024_BATCH_101', where the first part before underscore is the blood type. Meera needs to extract blood types from mixed inventory codes to categorize donations for distribution.

Approach

Given a blood bank code in format [TYPE]_[YEAR]_BATCH_[NUM], extract the blood type before the first underscore.

Input

O+_2024_BATCH_101

Output

O+
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
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3