#include <bits/stdc++.h>
using namespace std;
char s[5050];
int judge(int len) {
  for (int i = 0; i < len / 2; i++)
    if (s[i] != s[len - 1 - i]) return -1;
  if (len & 1) {
    bool aaabaaa = true;
    for (int i = 1; i < len / 2; i++) aaabaaa &= s[i] == s[i - 1];
    return aaabaaa ? 0 : 2;
  } else {
    int stat = judge(len / 2);
    if (stat == -1)
      return 1;
    else if (stat == 1)
      return 1;
    else if (stat == 2)
      return 2;
    else {
      if ((len / 2) & 1) {
        if (s[(len / 2) / 2] != s[0])
          return 2;
        else
          return 0;
      } else {
        return 0;
      }
    }
  }
}
int main() {
  scanf("%s", s);
  int len = strlen(s);
  int stat = judge(len);
  if (stat == 0)
    printf("Impossible\n");
  else
    printf("%d\n", judge(len));
  return 0;
}
