#CCBCHHAI0000011. Đoán mật mã (Guess the Four-Digit Code)

Đoán mật mã (Guess the Four-Digit Code)

Guess the Four-Digit Code

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

A device stores a four-digit integer secret. Guesses arrive in order and the device stops at the first exact match. Print the number of attempts, including the correct guess.

Input

The first value is the secret s. Following values are guesses; the final guess equals s and all prior guesses differ from s.

Output

Print the positive number of attempts until the first correct guess.

Subtasks

  • Subtask 1 (20%): At most 5 guesses, all codes in [1000,9999][1000,9999].
  • Subtask 2 (30%): At most 100 guesses, all codes in [1000,9999][1000,9999].
  • Subtask 3 (50%): At most 100001100001 guesses, all codes in [1000,9999][1000,9999].

Examples

Example 1

Input

1234 1111 1234

Output

2

Explanation

Guess 1111 is incorrect; guess 1234 is correct on attempt two.

Example 2

Input

9999 9999

Output

1

Explanation

The first guess is correct, so the count is one.