#include <bits/stdc++.h>
using namespace std;
int solveOdd(const string& s) {
return 2;
}
int solveEven(const string& s) {
if (s.length() % 2 == 1) {
return 2;
}
string lf = s.substr(0, s.length() / 2);
string rg = s.substr(s.length() / 2, s.length() / 2);
if (lf != rg) return 1;
return solveEven(lf);
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
string s;
cin >> s;
if (s.length() < 3) {
cout << "Impossible" << endl;
return 0;
}
vector<int> cnt(255);
for(char c : s) {
++cnt[c];
}
if (*max_element(cnt.begin(), cnt.end()) >= s.length() - 1) {
cout << "Impossible" << endl;
return 0;
}
cout << (s.length() % 2 == 0 ? solveEven(s) : solveOdd(s)) << endl;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgc29sdmVPZGQoY29uc3Qgc3RyaW5nJiBzKSB7CiAgICByZXR1cm4gMjsKfQoKaW50IHNvbHZlRXZlbihjb25zdCBzdHJpbmcmIHMpIHsKICAgIGlmIChzLmxlbmd0aCgpICUgMiA9PSAxKSB7CiAgICAgICAgcmV0dXJuIDI7CiAgICB9CiAgICBzdHJpbmcgbGYgPSBzLnN1YnN0cigwLCBzLmxlbmd0aCgpIC8gMik7CiAgICBzdHJpbmcgcmcgPSBzLnN1YnN0cihzLmxlbmd0aCgpIC8gMiwgcy5sZW5ndGgoKSAvIDIpOwogICAgaWYgKGxmICE9IHJnKSByZXR1cm4gMTsKICAgIHJldHVybiBzb2x2ZUV2ZW4obGYpOwp9CgoKaW50MzJfdCBtYWluKCkgewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CiAgICBjaW4udGllKG51bGxwdHIpLCBjb3V0LnRpZShudWxscHRyKTsKCiAgICBzdHJpbmcgczsKICAgIGNpbiA+PiBzOwogICAgaWYgKHMubGVuZ3RoKCkgPCAzKSB7CiAgICAgICAgY291dCA8PCAiSW1wb3NzaW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