open Batteries
let s = String.explode (read_line ())
let t = String.explode (read_line ())
let news = s @ [List.hd (List.rev t)]
let ans = List.fold_left2 (fun b x y -> if x = y then b else false) true news t
let () = print_endline (if ans then "Yes" else "No")