Doors in the Center

ABC 398

Problem 18 of 50

Easy

What to do

Create a palindrome string of length `n` using only '-' and '=' characters. If n is odd, place exactly one '=' in the center. If n is even, place exactly two '=' in the center. Fill the rest with '-'. For example, n=5 → '--=--', n=4 → '-==-'.

Key Concepts

strings palindromes conditional statements loops

Examples

Input: n = 4

Output: -==-

Input: n = 7

Output: ---=---

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...