11/22 String

ABC 381

Problem 35 of 50

Easy

What to do

Check if a string made of '1', '2', and '/' is an 11/22 string. Rules: odd length, the first half is all '1's, the exact middle character is '/', and the second half is all '2's. Return 'Yes' or 'No'. Example: '11/22' → 'Yes', '/' → 'Yes'.

Key Concepts

if-statements string manipulation length of strings basic condition checking

Examples

Input: s = '11/22'

Output: Yes

Input: s = '/'

Output: Yes

Tips for Beginners

  • Focus on understanding the logic, not memorizing syntax
  • Use print statements to debug your code
  • Don't worry about input parsing - the function handles that for you
  • If stuck, try writing out your solution on paper first

Python Editor

Loading Python...