Ten Player Bingo

시간 제한1초메모리 제한2048 MB

요약
1부터 100까지의 수가 섞여 있을 때, 각 끝자리 숫자별로 마지막에 모든 수를 듣는 플레이어가 누구인지 구한다.
난이도

쉬움10점 중 2점

유형
구현, 배열
정답자
아직 제출이 없습니다

문제

Bingo is a game of chance for multiple players. Each player receives a sheet with some numbers, and a game master then calls out these numbers in a random order. Players cross off the numbers that they have heard, and the first player to cross off all their numbers wins the game. This basic version of the game has a reputation for being, well, a bit sedate. No particular action is required of the players except for not falling asleep.

In this problem we will analyze a specific version of Bingo that requires exactly ten players. In our version, called Ten Player Bingo, each player is numbered from 11 to 1010. Each player also receives a sheet that contains the integers from 11 to 100100 that share the same units digit as the units digit of the player’s number. The game master has also been given a sheet that contains every integer from 11 to 100100 exactly once, but the integers have been shuffled. The game master will read the integers in the order presented on the sheet. When a player has heard all of their integers, they shout “BINGO” and leave the game. The game continues until everyone has shouted “BINGO”.

Who is the last player to shout “BINGO”?

입력

The first and only line of input contains 100100 integers, each ranging from 11 to 100100. It is guaranteed each integer appears exactly once.

출력

Output a single integer, which is the number of the player who shouts “BINGO” last.

예제1

  1. 예제 1

    입력
    12 91 49 4 52 95 45 51 50 40 11 5 88 87 39 38 42 89 76 85 30 69 35 81 23 67 32 3 62 8 79 58 1 75 37 27 24 46 18 16 97 61 41 59 13 74 78 54 98 66 14 33 86 55 83 93 63 72 6 19 92 17 56 64 100 53 28 71 7 96 36 57 84 43 73 60 15 77 80 31 20 99 21 90 70 22 26 10 25 2 94 9 82 34 65 68 48 29 44 47
    
    예상 출력
    7