Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/case-tosh-qaychi-qogoz

Rock, paper, scissors

Easy 1000 ms 64 MB 22%
Share

The moves of two players in rock, paper, scissors are given (t — rock, q — scissors, g — paper). Rules: rock beats scissors, scissors cut paper, paper covers rock. Determine the result: print $1$ if the first player wins, $2$ if the second player wins, and $0$ for a draw.

The circular rule of rock, scissors and paper

Input

One line with two characters: the first and the second player's choice.

Output

One integer: $1$, $2$ or $0$.

Note

The characters are only t, q or g.

Examples

Input #1
t q
Output #1
1
Input #2
g q
Output #2
2

Sign in to submit a solution

Signing up is free and takes a minute.