Problem: We call a string good, if after merging all the consecutive equal characters, the resulting string is palindrome. For example, "aabba" is good, because after the merging step it will become "aba".

Given a string, you have to find two values:

  1. the number of good substrings of even length; 
  2. the number of good substrings of odd length. 

Input

The first line of the input contains a single string of length n (1 ≤ n ≤ 105). Each character of the string will be either 'a' or 'b'.

Output

Print two space-separated integers: the number of good substrings of even length and the number of good substrings of odd length.

Examples

Input

bb


Output

1 2


Input

baab


Output

2 4


Input

babb


Output

2 5


Input

babaa


Output

2 7

Note

In example 1, there are three good substrings ("b", "b", and "bb"). One of them has even length and two of them have odd length.

In example 2, there are six good substrings (i.e. "b", "a", "a", "b", "aa", "baab"). Two of them have even length and four of them have odd length.

In example 3, there are seven good substrings (i.e. "b", "a", "b", "b", "bb", "bab", "babb"). Two of them have even length and five of them have odd length.

Definitions

A substring s[l, r] (1 ≤ l ≤ r ≤ n) of string s = s1s2... sn is string slsl + 1... sr.

A string s = s1s2... sn is a palindrome if it is equal to string snsn - 1... s1.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MAXLEN = 300000 + 5;
char s[MAXLEN];
int Next[26][MAXLEN];
int len[MAXLEN];
int link[MAXLEN];
int semi_link[MAXLEN];
long long int dp1[MAXLEN];
long long int dp2[MAXLEN];
int diff[MAXLEN];
int ar1[100100];
long long int cum[100100];
long long int rsq(int a, int b) {
  if (a > b) return 0;
  if (a == 0) return cum[b];
  return cum[b] - cum[a - 1];
}
struct PalindromicTree {
  unsigned cnt[MAXLEN];
  int sz;
  int last;
  long long int ans1, ans2;
  void init() { ans1 = ans2 = 0; }
  PalindromicTree(int n) {
    sz = last = 2;
    diff[2] = 0;
    diff[1] = 0;
  }
  void single(long long int a) {
    long long int odd = (a + 1) / 2;
    long long int even = (a / 2);
    ans1 += even * (a + 1) - (even * (even + 1));
    ans2 += odd * (a + 1) - odd * odd;
    return;
  }
  void buildTree() {
    sz = last = 2;
    len[1] = -1;
    link[1] = semi_link[1] = 1;
    len[2] = 0;
    link[2] = 1;
    semi_link[2] = 2;
    dp1[2] = 0;
    dp2[2] = 0;
    int n = strlen(s);
    for (int i = 0; i < n; i++) {
      Insert(i, s[i] - 'a');
      single(ar1[i]);
    }
    return;
  }
  void calculate(int i, int pos) {
    int cur = i;
    while (len[cur] > 1) {
      dp1[cur] = 0;
      dp2[cur] = 0;
      if (diff[cur] == diff[link[cur]]) {
        int temp = rsq(pos - diff[cur] + 1, pos - 1);
        if (temp % 2) {
          dp1[cur] = dp2[link[cur]];
          dp2[cur] = dp1[link[cur]];
        } else {
          dp1[cur] = dp1[link[cur]];
          dp2[cur] = dp2[link[cur]];
        }
        int x = pos - diff[cur] - len[semi_link[cur]] + 1;
        int sum = rsq(x + 1, pos - 1);
        int p = ar1[x];
        int even = (p / 2), odd = (p + 1) / 2;
        if (sum % 2) {
          dp1[cur] += even;
          dp2[cur] += odd;
        } else {
          swap(odd, even);
          dp1[cur] += even;
          dp2[cur] += odd;
        }
      } else {
        int x = pos - len[cur] + 1;
        int sum = rsq(x + 1, pos - 1);
        int p = ar1[x];
        int even = (p / 2), odd = (p + 1) / 2;
        if (sum % 2) {
          dp1[cur] = even;
          dp2[cur] = odd;
        } else {
          swap(odd, even);
          dp1[cur] = even;
          dp2[cur] = odd;
        }
      }
      int x = ar1[pos];
      int odd = (x + 1) / 2;
      int even = (x) / 2;
      ans1 += dp1[cur] * odd;
      ans1 += dp2[cur] * even;
      ans2 += dp1[cur] * even;
      ans2 += dp2[cur] * odd;
      if (ar1[pos] % 2) swap(dp1[cur], dp2[cur]);
      cur = semi_link[cur];
    }
  }
  bool Insert(int pos, char c) {
    int cur = last, curlen = 0;
    while (true) {
      curlen = len[cur];
      if (pos - 1 - curlen >= 0 && s[pos - 1 - curlen] == s[pos]) break;
      cur = link[cur];
    }
    if (Next[c][cur]) {
      last = Next[c][cur];
      calculate(last, pos);
      return false;
    }
    sz++;
    last = sz;
    len[sz] = len[cur] + 2;
    Next[c][cur] = sz;
    if (len[sz] == 1) {
      diff[sz] = 1;
      link[sz] = 2;
      cnt[sz] = 1;
      semi_link[sz] = 2;
      calculate(sz, pos);
      return true;
    }
    while (true) {
      cur = link[cur];
      curlen = len[cur];
      if (pos - 1 - curlen >= 0 && s[pos - 1 - curlen] == s[pos]) {
        link[sz] = Next[c][cur];
        break;
      }
    }
    int t = link[sz];
    diff[sz] = len[sz] - len[t];
    if (diff[sz] == diff[t]) {
      semi_link[sz] = semi_link[t];
    } else
      semi_link[sz] = t;
    calculate(sz, pos);
    return true;
  }
};
int x, y;
PalindromicTree pal(MAXLEN);
char str[100010];
int main() {
  while (scanf("%s", str) != EOF) {
    memset(Next, 0, sizeof(Next));
    int n = 0;
    for (int i = 0; str[i]; i++)
      if (i && str[i] == str[i - 1])
        ar1[n - 1]++;
      else {
        ar1[n] = 1;
        s[n] = str[i];
        n++;
      }
    s[n] = '\0';
    for (int i = 0; i < n; i++)
      if (i) cum[i] = cum[i - 1] + ar1[i];
    pal.init();
    pal.buildTree();
    cout << pal.ans1 << " " << pal.ans2 << endl;
  }
  return 0;
}