public void solve() throws IOException {
    String a = nextLine();
    BigInteger result = new BigInteger("1");
    int last = -1;
    long count = 0;
    for (int x = 0; x < a.length() - 1; x++) {
      int cur = Integer.valueOf(a.charAt(x)) - 48;
      int next = Integer.valueOf(a.charAt(x + 1)) - 48;
      if (cur + next == 9 && count == 0) {
        last = cur;
        count += 2;
      } else if (next == last && count > 0) {
        count++;
        last = cur;
      } else if (count > 0) {
        if (count % 2 == 1)
          result = result.multiply(new BigInteger("2"));
        count = 0;
      }
    }
    if (count % 2 == 1)
      result = result.multiply(new BigInteger("2"));
    System.out.println(result);
  }