#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
static int roundToInt(double x) {
  return (x < 0) ? -(int)(-x + 0.5) : (int)(x + 0.5);
}
class Var {
 public:
  string sval;
  double dval;
  enum VarType { STRING = 0, NUMBER = 1 };
  VarType type;
  enum NumericState { UNKNOWN = -1, STRINGY = 0, NUMERIC = 1 };
  mutable NumericState numericState;
  Var() {
    sval = "";
    type = STRING;
    numericState = STRINGY;
  }
  Var(string s) {
    sval = s;
    type = STRING;
    numericState = UNKNOWN;
  }
  Var(double d) {
    dval = d;
    type = NUMBER;
    numericState = NUMERIC;
  }
  Var(const Var &v) {
    sval = string(v.sval);
    dval = v.dval;
    type = v.type;
    numericState = v.numericState;
  }
  static bool isNumericString(const string &s) {
    char *ep;
    strtod(s.c_str(), &ep);
    return !ep || !*ep;
  }
  bool isNumeric() const {
    if (type == NUMBER) return true;
    if (numericState != UNKNOWN) return numericState == NUMERIC;
    bool numeric = isNumericString(sval);
    numericState = (numeric) ? NUMERIC : STRINGY;
    return numeric;
  }
  double asNumber() const {
    if (type == NUMBER) return dval;
    return (isNumeric()) ? atof(sval.c_str()) : 0.0;
  }
  static bool isNearInteger(const double &x) {
    return fabs(round(x) - x) < EPS;
  }
  static bool isNearNumber(const double &x, const double &y) {
    return fabs(x - y) < EPS;
  }
  string asString() const {
    if (type == STRING) return sval;
    if (isNearInteger(dval)) return to_string(roundToInt(dval));
    return to_string(dval);
  }
  Var operator+(const Var &y) const {
    return Var(this->asNumber() + y.asNumber());
  }
  Var operator+=(const Var &y) {
    *this = *this + y;
    return *this;
  }
  Var operator-(const Var &y) const {
    return Var(this->asNumber() - y.asNumber());
  }
  Var operator*(const Var &y) const {
    return Var(this->asNumber() * y.asNumber());
  }
  Var operator/(const Var &y) const {
    return Var(this->asNumber() / y.asNumber());
  }
  Var operator%(const Var &y) const {
    return Var(fmod(this->asNumber(), y.asNumber()));
  }
  bool operator<(const Var &y) const {
    if (this->isNumeric() && y.isNumeric()) {
      return this->asNumber() < y.asNumber();
    }
    return this->asString() < y.asString();
  }
  bool operator>(const Var &y) const { return y < *this; }
  bool operator==(const Var &y) const {
    if (this->isNumeric() && y.isNumeric()) {
      return this->asNumber() == y.asNumber();
    }
    return this->asString() == y.asString();
  }
  friend ostream &operator<<(ostream &os, const Var &p);
  friend istream &operator>>(istream &is, const Var &p);
};
ostream &operator<<(ostream &os, const Var &p) {
  os << p.asString();
  return os;
}
istream &operator>>(istream &is, Var &p) {
  string s;
  is >> s;
  p = Var(s);
  return is;
}
Var letterOf(Var index, Var sourceString) {
  string str = sourceString.asString();
  int idx = (int)(index.asNumber() - 1);
  if (0 <= idx && idx < str.size()) return Var(str.substr(idx, 1));
  return Var();
}
class VarList {
 public:
  vector<Var> data;
  VarList(const vector<Var> &x) { data = x; }
  void push_back(const Var &x) { data.push_back(x); }
  void pop_back() { data.pop_back(); }
  void clear() { data.clear(); }
  int size() { return (int)data.size(); }
  Var getLineOfList(const Var &index) const {
    int idx = (int)index.asNumber() - 1;
    if (0 <= idx && idx < data.size()) return data[idx];
    return Var();
  }
  void setLineOfListTo(const Var &index, const Var &v) {
    int idx = (int)index.asNumber() - 1;
    if (0 <= idx && idx < data.size()) data[idx] = v;
  }
  void deleteLineOfList(const Var &index) {
    string kwd = index.asString();
    if (kwd == "all") {
      data.clear();
    } else if (kwd == "last") {
      data.pop_back();
    } else {
      int idx = (int)index.asNumber() - 1;
      if (0 <= idx && idx < data.size()) data.erase(data.begin() + idx);
    }
  }
  void insertAtIndexOfList(const Var &item, const Var &index) {
    int idx = (int)index.asNumber() - 1;
    if (0 <= idx && idx <= data.size()) data.insert(data.begin() + idx, item);
  }
  void insertAtRandomOfList(const Var &item) {
    int idx = rand() % (data.size() + 1);
    data.insert(data.begin() + idx, item);
  }
  string asString() const {
    string ret;
    for (int i = 0; i < data.size(); i++) {
      if (i > 0) ret += ' ';
      ret += data[i].asString();
    }
    return ret;
  }
  int itemNumOfList(const Var &item) const {
    auto itr = find(data.begin(), data.end(), item);
    if (itr == data.end()) return 0;
    return 1 + (int)(itr - data.begin());
  }
  friend ostream &operator<<(ostream &os, const VarList &p);
};
ostream &operator<<(ostream &os, const VarList &p) {
  os << p.asString();
  return os;
}
double randUniform(double x, double y) {
  if (x > y) return randUniform(y, x);
  if (Var::isNearInteger(x) && Var::isNearInteger(y)) {
    int xi = roundToInt(x), yi = roundToInt(y);
    return xi + rand() % (yi - xi + 1);
  } else {
    return x + (y - x) * (0.0 + rand()) / RAND_MAX;
  }
}
Var buf_answer;
Var var_S(0);
Var var_i(1);
Var var_blue(1);
Var var_red(0);
int main();
int func_init();
int func_main();
int main() {
  func_init();
  cin >> buf_answer;
  var_S = buf_answer;
  func_main();
  return 0;
}
int func_init() {
  var_blue = Var(0);
  var_red = Var(0);
  return 0;
}
int func_main() {
  var_i = Var(0);
  for (int xutbtxzm = 0; xutbtxzm < Var(var_S.asString().size()).asNumber();
       xutbtxzm++) {
    if ((letterOf(var_i, var_S) == Var(0))) {
      var_red = (var_red + Var(1));
    } else {
      var_blue = (var_blue + Var(1));
    }
    var_i = (var_i + Var(1));
  }
  if ((var_red > var_blue)) {
    cout << (var_blue * Var(2)) << endl;
    return 0;
  }
  cout << (var_red * Var(2)) << endl;
  return 0;
}
