import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int read() { return readln.chomp.to!int; }
int[] reads() { return readln.split.to!(int[]); }

void main() {
    dchar[] s = readln.chomp.to!(dchar[]);
    dchar[] t = readln.chomp.to!(dchar[]);

    bool can() {
        foreach (_; 0..s.length+1) {
            bringToFront(s[0..1], s[1..$]);
            if (s == t) return true;
        }
        return false;
    }

    writeln(can() ? "Yes" : "No");
}
