program RotationCheck;
uses SysUtils;
function IsRotation(s1, s2: string): Boolean;
begin
IsRotation := (Length(s1) = Length(s2)) and (Pos(s2, s1 + s1) <> 0);
end;
var
s1, s2: string;
begin
s1 := 'abbc';
s2 := 'cabb';
if IsRotation(s1, s2) then
WriteLn('yes')
else
WriteLn('no');
s1 := 'abbc';
s2 := 'bbac';
if IsRotation(s1, s2) then
WriteLn('yes')
else
WriteLn('no');
end.
(*
run:
yes
no
*)