#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>

using namespace std;

vector<int> ansbunsi;
vector<int>ansbunbo;
int main(){
	while(true){
		string str;
		cin >> str;
		if(str == "#") break;
		
		reverse(str.begin(),str.end());
		
		int bunbo = 1,bunsi = 0;
		int cur = 0;
		
		if(str[cur] == 'h'){
			bunsi = 0;
			cur += 5;
		}else{
			bunsi = 90;
			cur += 4;
		}
		
		while(cur < str.size()){
			bunbo *= 2;
			if(str[cur] == 'h'){
				bunsi = max(0,bunsi*2 - 90);
				cur += 5;
			}else{
				bunsi = min(bunbo*90,bunsi*2 + 90);
				cur += 4;
			}
		}
		
		while(bunsi % 2 == 0 && bunsi != 0 && bunbo % 2 == 0){
			bunsi /= 2;
			bunbo /= 2;
		}
		
		ansbunsi.push_back(bunsi);
		ansbunbo.push_back(bunbo);
	}
	
	for(int i = 0;i < ansbunsi.size();i++){
		if(ansbunbo[i] == 1){
			cout << ansbunsi[i] << endl;
		}else{
			cout << ansbunsi[i] << "/" << ansbunbo[i] << endl; 
		}
	}
	
	return 0;
}
