Seats

ABC 375

Problem 41 of 50

Easy

What to do

You have a row of seats that can either be occupied or empty. Your task is to count how many times there is a person sitting in seat i and seat i + 2, with an empty seat in between (seat i + 1).

Key Concepts

if-statements loops string manipulation counting occurrences

Examples

Input: 6, '#.##.#'

Output: 2

Input: 1, '#'

Output: 0

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