program prob2
    implicit none
    integer::i, l, j
    character(len=100)::S,T
    character::s1,t1
    read(*,*) S
    read(*,*) T
    l = len_trim(S)

    do j = 1, l
        do i = 1, l
            if(S(i:i) .ne. T(i:i))then
                exit
            else if(i == l)then
                write(*,'(a)') "Yes"
                stop
            end if
        end do
        s1 = S(1:1)
        t1 = T(1:1)
        do i = 1, l-1
            S(i:i) = S(i+1:i+1)
        end do
        S(l:l) = s1
    end do

    write(*,'(a)')  "No"
    stop
end program