#include <bits/stdc++.h>

using namespace std;

void rec(string &s, int &a, int &b) {
  if (s == "") return;
  if (s.back() == 'h') {
    a -= (a > 0);
    s = s.substr(0, s.size() - 5);
  } else {
    a += (a < b);
    s = s.substr(0, s.size() - 4);
  }
  a <<= 1, b <<= 1;
  rec(s, a, b);
}

int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main(void) {
  string s;
  while (cin >> s, s != "#") {
    int a = 0, b = 1;
    rec(s, a, b);

    a *= 90;
    int g = gcd(a, b);
    a /= g, b /= g;
    if (a == 0) {
      cout << 0 << endl;
    } else if (b == 1) {
      cout << a << endl;
    } else {
      cout << a << "/" << b << endl;
    }
  }

  return 0;
}
