#include <bits/stdc++.h>
#include <ext/rope>
using namespace std;
using namespace __gnu_cxx;
typedef long long ll;
const ll MAXN = 1e5 + 100;

#define x first
#define y second
map<string, bool> m;

int main() {
    string s = "abbaabbaabba";
    int kol = 0;
    for (int i = 0; i < s.length(); ++i) {
        string s1 = s.substr(0, s.length() - 1);
        s1 = s[s.length() - 1] + s1;
        if (!m[s]) {
                cout << s1 << '\n';
            ++kol;
            m[s] = true;
        }
        s = s1;
    }
    cout << kol;
    return 0;
}
