#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

int c2i(char c) {
  return isupper(c) ? c-'A' : c-'a'+26;
}

char i2c(int i) {
  return i < 26 ? i+'A' : i-26+'a';
}

const int n = 52;
int G[n][n];
bool used[1000];
vector<char> path;
void dfs(int u, int& cnt, int e, const int& E) {
  if(e == E) {
    //rep(i, path.size()) cout << path[i] << " ";
    //cout << endl;
    ++cnt;
    return;
  }
  for(int v = 0; v < n; ++v) {
    if(G[u][v] != -1 && !used[G[u][v]]) {
      used[G[u][v]] = true;
      //path.push_back(i2c(v));
      dfs(v, cnt, e+1, E);
      //path.pop_back();
      used[G[u][v]] = false;
      if(cnt >= 2) return;
    }
  }
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string s;
  while(cin >> s, s != "#") {
    int len = s.size();
    if(len <= 2) {
      cout << "No Results" << endl;
      continue;
    }

    fill(G[0], G[n], -1);
    int E = 0;
    vint in(n, 0), out(n, 0);
    rep(i, len-1) {
      int from = c2i(s[i]), to = c2i(s[i+1]);
      if(G[from][to] == -1) {
	G[from][to] = E++;
	++out[from];
	++in[to];
      }
    }
    int D = 0;
    rep(i, n) D += max(0ll, in[i]-out[i]);
    if(D == 0) cout << E+1 << endl;
    else if(D != 1) cout << E+D << endl;
    else if(E+1 < len) cout << E+1 << endl;
    else {
      fill(used, used+E, false);
      int cnt = 0;
      //path.push_back(s[0]);
      dfs(c2i(s[0]), cnt, 0, E);
      //path.pop_back();
      if(cnt == 2) cout << E+1 << endl;
      else cout << E+2 << endl;
    }
  }

  return 0;
}

