program prob2
    implicit none
    character(len=100) :: S, T
    integer :: i, N

    read(*,*) S, T

    N = len_trim(S)
    do i = 1, N-1
        if(S(1:i) == T(N-i+1:N) .and. S(i+1:N) == T(1:N-i)) then
            write(*,*) 'Yes'
            stop
        end if
    end do
    if(S == T)then
        write(*,*) 'Yes'
        stop
    end if

    write(*,*) 'No'

    stop
contains
end program prob2