import Control.Monad
import Data.Char
import Data.List
import qualified Data.Vector.Mutable as MV
import Text.Printf

solve c = trans codePoint
  where
    codePoint = fromEnum c
    trans codePoint
      | 97 <= codePoint && codePoint <= 122 = toEnum (codePoint - 32) :: Char
      | 65 <= codePoint && codePoint <= 90 = toEnum (codePoint + 32) :: Char
      | otherwise = c

main1 = do
  string <- getLine
  putStrLn $ map solve string

solve2 :: String -> Int
solve2 numbers = sum $ map (\n -> (fromEnum n) - (fromEnum '0')) numbers
  -- foldr (\n m -> m + ((fromEnum n) - 48)) 0 numbers

main2 = do
  strings <- fmap (takeWhile (/= "0") . lines) getContents
  let ints = map solve2 $ strings
  mapM_ (putStrLn . show) $ ints

main3 = do
  strings <- getContents
  vector <- MV.replicate 26 0
  solve3' strings vector
  forM_ (zip [0..25] ['a'..'z']) $ \ia -> do
    let (i,a) = ia
    count <- MV.read vector i
    putStrLn $ [a] ++ " : " ++ (show count)

solve3 list = map (\(n:ns) -> (n,length (n:ns))) list'
  where
    list' = group . sort . filter isAlpha . map toLower $ list

solve3' list vector = do
  forM_ list $ \n -> do
    when (isAlpha n) $ do
      let c = fromEnum n
      if 97 <= c
        then do
        MV.read vector (c-97) >>= (\v -> MV.write vector (c-97) (v+1))
        else do
        MV.read vector (c-65) >>= (\v -> MV.write vector (c-65) (v+1))


main = do
  s <- getLine
  p <- getLine
  putStrLn $ if solve4 s p then "Yes" else "No"

solve4 s p = p `elem` ringStrings
  where
    pLength = length p
    ringStrings = map (take pLength) $ genRingStrings s

genRingStrings list = loop list (length list) []
  where
    loop (p:ps) n list
      | n == 0 = list
      | otherwise = loop psp (n-1) (list ++ [(p:ps)])
      where
        psp = ps ++ [p]

