program main implicit none character*3::b,f integer*8::N,bx,fx,i,bp,fp data bx,fx/2*0/ read *,b,N,f do i=1,3 if(b(i:i).eq.'x') bx = bx + 1 if(f(i:i).eq.'x') fx = fx + 1 end do if(bx.ne.fx) then print '(a)', "SUCCESS" return else if(bx.eq.3.or.bx.eq.0) then print '(a)', "FAILURE" return end if if(bx.eq.1) then bp = SCAN(b,'x') fp = SCAN(f,'x') else bp = SCAN(b,'o') fp = SCAN(f,'o') end if if(MOD(fp+bp,2).eq.MOD(N,2)) then print '(a)', "FAILURE" return else print '(a)', "SUCCESS" return end if end program main