⌘K
Flycodx

Validate Crypto Pair Sequence

Validate Crypto Pair Sequence

MediumStrings0% accepted

Arjun's exchange in Mumbai processes trading pairs in a specific format. Valid pairs are two 3-4 letter codes (uppercase) separated by underscore, optionally followed by underscore and order type (MARKET, LIMIT, STOP). Count valid pairs in a comma-separated sequence.

Approach

Given a comma-separated string of trading pairs, count how many pairs follow the format CODE1_CODE2 or CODE1_CODE2_TYPE where CODE1/CODE2 are 3-4 uppercase letters and TYPE is a valid order type.

Input

BTC_ETH,XRP_INR_MARKET

Output

2
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