def pata(x,s): if x[0]=="U": if x[1]==s: p = (x[6][0]+3,x[6][1]+1) res = ("D",x[3],x[2],x[1],x[4],p,x[5]) elif x[2]==s: p = (x[4][0],x[4][1]-2) res = ("D",x[2],x[1],x[3],x[6],x[5],p) else: #print(x[5]) p = (x[5][0]-3,x[5][1]+1) res = ("D",x[1],x[3],x[2],p,x[4],x[6]) else: if x[1]==s: p = (x[6][0],x[6][1]+2) res = ("U",x[2],x[1],x[3],p,x[5],x[4]) elif x[2]==s: p = (x[4][0]+3,x[4][1]-1) res = ("U",x[1],x[3],x[2],x[5],p,x[6]) else: p = (x[5][0]-3,x[5][1]-1) res = ("U",x[3],x[2],x[1],x[4],x[6],p) return res val = set([("U","a","b","c",(1,1),(2,0),(0,0))]) pos = ("U","a","b","c",(1,1),(2,0),(0,0)) S = input() for i in range(len(S)): pos = pata(pos,S[i]) val.add(pos) #print(pos) print(len(val))