#include <stdio.h>
int T,F,R,c,a,t;char s[9];
int main()
{
for(;c+21&&scanf("%s",s);a+=T)
c=*s-69,
c<0?a&&printf("%d\n",a),a=0,T=1,F=2,R=3:0,
c==9?t=T,T=F,F=7-t:0,
c==14?t=F,F=T,T=7-t:0,
!c?t=R,R=T,T=7-t:0,
c==18?t=T,T=R,R=7-t:0,
c==13?t=F,F=R,R=7-t:0,
c==7?t=R,R=F,F=7-t:0;
}