Practice
Character Position Finder
2023/May/Jun·Variant 2
MEDIUMString Processing
Input a string P and a single character Q. Convert both to uppercase, then find the 1-based position of the first occurrence of Q in P. Output 0 if not found.
Input: A string, then a single character. Output: An integer representing the position (or 0).
Example:
Input: The world
w
Output: 5
Premium is coming soon. All grading features are currently unlocked.
Sample Test Cases
Test 1: Found (case insensitive)
Inputs: The world, w
Expected: 5
Test 2: Not found
Inputs: Apple, z
Expected: 0
Ctrl+Enter
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade