#include <bits/stdc++.h>
using namespace std;
const int BASE = 100069;
const int MOD = 1000000097;
int N;
char S[5004];
int powers[5004];
int fwd_hash[5004][5004];
int rev_hash[5004][5004];
void init() {
  powers[0] = 1;
  for (int i = 1; i <= N; ++i) powers[i] = (powers[i - 1] * 1LL * BASE) % MOD;
  for (int i = 0; i < N; ++i) {
    int h = 0;
    for (int j = i; j < N; ++j) {
      h = (h * 1LL * BASE + S[j]) % MOD;
      fwd_hash[i][j] = h;
    }
  }
  for (int j = N - 1; j >= 0; --j) {
    int h = 0;
    for (int i = j; i >= 0; --i) {
      h = (h * 1LL * BASE + S[i]) % MOD;
      rev_hash[i][j] = h;
    }
  }
}
inline int getHash(pair<int, int> p1, pair<int, int> p2, pair<int, int> p3) {
  return (p1.first * 1LL * powers[p2.second + p3.second] +
          p2.first * 1LL * powers[p3.second] + p3.first) %
         MOD;
}
vector<int> getHashesOnTwoCuts(pair<int, int> p1, pair<int, int> p2,
                               pair<int, int> p3, int exclude_hash,
                               vector<int>& res) {
  res.reserve(5);
  int cur = getHash(p1, p3, p2);
  if (cur != exclude_hash) res.push_back(cur);
  cur = getHash(p2, p1, p3);
  if (cur != exclude_hash) res.push_back(cur);
  cur = getHash(p2, p3, p1);
  if (cur != exclude_hash) res.push_back(cur);
  cur = getHash(p3, p1, p2);
  if (cur != exclude_hash) res.push_back(cur);
  cur = getHash(p3, p2, p1);
  if (cur != exclude_hash) res.push_back(cur);
  sort(res.begin(), res.end());
  return res;
}
int solve() {
  map<char, int> freq;
  for (int i = 0; i < N; ++i) {
    char c = S[i];
    ++freq[c];
  }
  if (int((freq).size()) == 1) return -1;
  if (N & 1) {
    if (int((freq).size()) == 2 && freq[S[N / 2]] == 1) return -1;
  }
  init();
  int entire_string_hash = fwd_hash[0][N - 1];
  for (int k = (1), _b = (N - 1); k <= _b; ++k) {
    int p1 = fwd_hash[0][k - 1];
    int p2 = fwd_hash[k][N - 1];
    int hf = (p2 * 1LL * powers[k] + p1) % MOD;
    if (hf == entire_string_hash) continue;
    int s1 = rev_hash[0][k - 1];
    int s2 = rev_hash[k][N - 1];
    int sf = (s1 * 1LL * powers[N - k] + s2) % MOD;
    if (hf == sf) {
      return 1;
    }
  }
  return 2;
}
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  cin >> S;
  N = strlen(S);
  int res = solve();
  if (res < 0)
    cout << "Impossible\n";
  else
    cout << res << '\n';
  return 0;
}
