import"io"for Stdin var s while(1)s=Stdin.readLine()&&System.print(s[s[1]!=s[2]?4:2])