Problem: You are given a string s consisting only of first 20 lowercase Latin letters ('a', 'b', ..., 't').

Recall that the substring s[l; r] of the string s is the string s_l s_{l + 1} ... s_r. For example, the substrings of "codeforces" are "code", "force", "f", "for", but not "coder" and "top".

You can perform the following operation no more than once: choose some substring s[l; r] and reverse it (i.e. the string s_l s_{l + 1} ... s_r becomes s_r s_{r - 1} ... s_l).

Your goal is to maximize the length of the maximum substring of s consisting of distinct (i.e. unique) characters.

The string consists of distinct characters if no character in this string appears more than once. For example, strings "abcde", "arctg" and "minecraft" consist of distinct characters but strings "codeforces", "abacaba" do not consist of distinct characters.

Input

The only line of the input contains one string s consisting of no more than 10^6 characters 'a', 'b', ..., 't' (first 20 lowercase Latin letters).

Output

Print one integer — the maximum possible length of the maximum substring of s consisting of distinct characters after reversing no more than one its substring.

Examples

Input


abacaba


Output


3


Input


abcdecdf


Output


6


Input


aabbcc


Output


3


Input


abcdeefc


Output


6

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
class CodeHash {
 public:
  string precise(double number, int prec) {
    stringstream ss;
    ss << fixed << setprecision(prec) << number;
    return ss.str();
  }
};
class ScanReader {
 private:
  FILE *stream;
  char buffer[1 << 11];
  bool is_digit[1 << 8];
  int index, total;
  int scan() {
    if (index >= total) {
      index = 0;
      total = fread(buffer, 1, 1 << 11, stream);
      if (total <= 0) return -1;
    }
    return buffer[index++];
  }
  bool iswhitespace(int n) {
    if (n == ' ' || n == '\n' || n == '\t' || n == '\r' || n == -1) return true;
    return false;
  }

 public:
  ScanReader(FILE *stream) {
    this->stream = stream;
    index = total = 0;
    for (int i = 0; i < 1 << 8; i++) is_digit[i] = isdigit(i);
  }
  int scanInt() {
    int integer = 0, temp = scan();
    while (iswhitespace(temp)) temp = scan();
    int neg = 1;
    if (temp == '-') neg *= -1, temp = scan();
    while (!iswhitespace(temp))
      if (is_digit[temp]) integer *= 10, integer += (temp - '0'), temp = scan();
    return neg * integer;
  }
  long long scanLong() {
    long long integer = 0;
    int temp = scan();
    while (iswhitespace(temp)) temp = scan();
    int neg = 1;
    if (temp == '-') neg *= -1, temp = scan();
    while (!iswhitespace(temp))
      if (is_digit[temp]) integer *= 10, integer += (temp - '0'), temp = scan();
    return neg * integer;
  }
  string scanString() {
    string ss = "";
    int temp = scan();
    while (iswhitespace(temp)) temp = scan();
    while (!iswhitespace(temp)) ss += temp, temp = scan();
    return ss;
  }
  double scanDouble() {
    int c = scan();
    while (iswhitespace(c)) c = scan();
    int sgn = 1;
    if (c == '-') sgn = -1, c = scan();
    double res = 0;
    while (!iswhitespace(c) && c != '.') {
      if (c == 'e' || c == 'E') return res * pow(10, scanInt());
      res *= 10;
      res += c - '0';
      c = scan();
    }
    if (c == '.') {
      c = scan();
      double m = 1;
      while (!iswhitespace(c)) {
        if (c == 'e' || c == 'E') {
          return res * pow(10, scanInt());
        }
        m /= 10;
        res += (c - '0') * m;
        c = scan();
      }
    }
    return res * sgn;
  }
};
class PrintWriter {
 private:
  FILE *stream;
  static const int BUFFER_SIZE = (1 << 11) - 1;
  static const int MAX_OUT_SIZE = 23;
  int size;
  char buffer[BUFFER_SIZE];
  void write(long long v) {
    if (v < 0) buffer[size++] = '-', v *= -1;
    if (v < 10)
      buffer[size++] = v + 48;
    else {
      write(v / 10);
      buffer[size++] = v % 10 + 48;
    }
  }

 public:
  PrintWriter(FILE *stream) {
    this->size = 0;
    this->stream = stream;
  }
  void close() {
    if (size) fwrite(buffer, 1, size, stream);
  }
  void println(long long s) {
    if ((size ^ BUFFER_SIZE) < MAX_OUT_SIZE) {
      fwrite(buffer, 1, size, stream);
      size = 0;
    }
    write(s);
    buffer[size++] = '\n';
  }
  void print(long long s) {
    if ((size ^ BUFFER_SIZE) < MAX_OUT_SIZE) {
      fwrite(buffer, 1, size, stream);
      size = 0;
    }
    write(s);
    buffer[size++] = ' ';
  }
  void println(string s) {
    if ((size ^ BUFFER_SIZE) < MAX_OUT_SIZE) {
      fwrite(buffer, 1, size, stream);
      size = 0;
    }
    for (int i = 0; i < s.length(); i++) {
      buffer[size++] = s[i];
      if ((size ^ BUFFER_SIZE) < MAX_OUT_SIZE) {
        fwrite(buffer, 1, size, stream);
        size = 0;
      }
    }
    buffer[size++] = '\n';
  }
  void print(string s) {
    if ((size ^ BUFFER_SIZE) < MAX_OUT_SIZE) {
      fwrite(buffer, 1, size, stream);
      size = 0;
    }
    for (int i = 0; i < s.length(); i++) {
      buffer[size++] = s[i];
      if ((size ^ BUFFER_SIZE) < MAX_OUT_SIZE) {
        fwrite(buffer, 1, size, stream);
        size = 0;
      }
    }
  }
};
FILE *fi = fopen("C:\\Users\\khokh\\CLionProjects\\compe\\in.txt", "r+");
FILE *fo = fopen("C:\\Users\\khokh\\CLionProjects\\compe\\out.txt", "w+");
int dp[1 << 20][20];
int main() {
  fi = stdin;
  fo = stdout;
  ScanReader *in = new ScanReader(fi);
  PrintWriter *out = new PrintWriter(fo);
  CodeHash *ch = new CodeHash();
  string ar = in->scanString();
  for (int i = 0; i < 20; i++) {
    for (int j = 0; j < 20; j++) dp[i][j] = INT_MIN;
  };
  for (int i = 0; i < ar.size(); i++) {
    int mask = 0;
    for (int j = i; j < ar.size(); j++) {
      if ((mask & (1 << (ar[j] - 'a'))) != 0) break;
      mask |= (1 << (ar[j] - 'a'));
      dp[mask][j - i] = max(dp[mask][j - i], j);
    }
  }
  for (int i = 0; i < 20; i++) {
    for (int j = 0; j < 1 << 20; j++) {
      if ((j & (1 << i)) != 0) {
        {
          for (int len = 0; len < 20; len++) {
            dp[j][len] = max(dp[j][len], dp[j ^ (1 << i)][len]);
          }
        }
      }
    }
  }
  int ans = 1;
  int msk = (1 << 20) - 1;
  for (int i = 0; i < ar.size(); i++) {
    int mask = 0;
    for (int j = i; j < ar.size(); j++) {
      if ((mask & (1 << (ar[j] - 'a'))) != 0) break;
      mask |= (1 << (ar[j] - 'a'));
      for (int k = 19; (j - i + k + 2) > ans; k--) {
        if (dp[msk ^ mask][k] > j) {
          ans = max(j - i + 1 + k + 1, ans);
          break;
        }
      }
    }
  }
  out->println(ans);
  out->close();
  return 0;
}