Skip to main content

~/algor $ cat contests/round-8/D

D. Rock, paper, scissors

Problem D ICPC rules 1000 ms 64 MB

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 if the first player wins, if the second player wins, and 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: , or .

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.