Language: C++

#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
pair<int,int>tasu(pair<int,int>a,pair<int,int>b){
	__int64 a1=a.first,a2=a.second,b1=b.first,b2=b.second;
	__int64 ta2=a2,tb2=b2;
	a1*=tb2,a2*=tb2;
	b1*=ta2,b2*=ta2;
	__int64 c1=a1+b1,c2=a2;
	for(int i=2;i<=1000000;i++){
	if(i==0||i==1||i==-1)continue;
	if(c1%i==0&&c2%i==0){
		c1/=i,c2/=i;
		i=-2;
	}
	}
	pair<int,int>c=make_pair(c1,c2);
	return c;
}
int main(){
	string n;
	//pair<int,int>a1,a2;
	//a1=make_pair(2,5);
	//a2=make_pair(3,6);
//	pair<int,int> tmp=tasu(a1,a2);
	//cout<<tmp.first<<" "<<tmp.second<<endl;

	while(true){
	cin>>n;
	if(n=="#")break;
	vector<char>dir(0);
	for(int i=0;i<n.size();i++){
	if(n[i]=='w')dir.push_back('w');
	if(n[i]=='n')dir.push_back('n');
	}
	reverse(dir.begin(),dir.end());
	pair<int,int> ans=make_pair(0,1);
	if(dir[0]=='w')ans.first=90;
	for(int i=1;i<dir.size();i++){
		pair<int,int>tmp;
		if(dir[i]=='w'){
		tmp=make_pair(90,pow(2,i));
		ans=tasu(ans,tmp);
		}
		else if(dir[i]=='n'){
		tmp=make_pair(-90,pow(2,i));
		ans=tasu(ans,tmp);
		}
	}
	if(ans.second==1)cout<<ans.first<<endl;
	else if(ans.first==0)cout<<0<<endl;
	else cout<<ans.first<<"/"<<ans.second<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'std::pair<int, int> tasu(std::pair<int, int>, std::pair<int, int>)':
a.cc:8:9: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
    8 |         __int64 a1=a.first,a2=a.second,b1=b.first,b2=b.second;
      |         ^~~~~~~
      |         __ynf64
a.cc:9:16: error: expected ';' before 'ta2'
    9 |         __int64 ta2=a2,tb2=b2;
      |                ^~~~
      |                ;
a.cc:10:9: error: 'a1' was not declared in this scope; did you mean 'a'?
   10 |         a1*=tb2,a2*=tb2;
      |         ^~
      |         a
a.cc:10:13: error: 'tb2' was not declared in this scope
   10 |         a1*=tb2,a2*=tb2;
      |             ^~~
a.cc:10:17: error: 'a2' was not declared in this scope; did you mean 'a'?
   10 |         a1*=tb2,a2*=tb2;
      |                 ^~
      |                 a
a.cc:11:9: error: 'b1' was not declared in this scope; did you mean 'b'?
   11 |         b1*=ta2,b2*=ta2;
      |         ^~
      |         b
a.cc:11:13: error: 'ta2' was not declared in this scope; did you mean 'tan'?
   11 |         b1*=ta2,b2*=ta2;
      |             ^~~
      |             tan
a.cc:11:17: error: 'b2' was not declared in this scope; did you mean 'b'?
   11 |         b1*=ta2,b2*=ta2;
      |                 ^~
      |                 b
a.cc:12:16: error: expected ';' before 'c1'
   12 |         __int64 c1=a1+b1,c2=a2;
      |                ^~~
      |                ;
a.cc:15:12: error: 'c1' was not declared in this scope; did you mean 'y1'?
   15 |         if(c1%i==0&&c2%i==0){
      |            ^~
      |            y1
a.cc:15:21: error: 'c2' was not declared in this scope
   15 |         if(c1%i==0&&c2%i==0){
      |                     ^~
a.cc:20:34: error: 'c1' was not declared in this scope; did you mean 'c'?
   20 |         pair<int,int>c=make_pair(c1,c2);
      |                                  ^~
      |                                  c
a.cc:20:37: error: 'c2' was not declared in this scope; did you mean 'c'?
   20 |         pair<int,int>c=make_pair(c1,c2);
      |                                     ^~
      |                                     c
a.cc: In function 'int main()':
a.cc:39:9: error: 'reverse' was not declared in this scope
   39 |         reverse(dir.begin(),dir.end());
      |         ^~~~~~~