-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path376A
More file actions
43 lines (40 loc) · 874 Bytes
/
Copy path376A
File metadata and controls
43 lines (40 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<bits/stdc++.h>
#define lli long long int
#define vi vector<int>
#define vlli vector<lli>
#define pii pair<int,int>
#define vpi vector<pii>
#define mp unordered_map<char,int>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pn printf("\n")
#define ff first
#define ss second
#define MOD1 1000000007
#define MOD2 1000000009
using namespace std;
int main()
{
lli m,n,t,b,c,d,i,j,k,x,y,z,l,q,r;
lli cnt=0,ans=0;
string s,s1;
while(cin>>s)
{
ans=0;
l=s.size();
for (int i=0;i<l;i++) {if(s[i]=='^') m=i;}
for (int i=0;i<l;i++)
{
if(isdigit(s[i]) )
{
ans+=(s[i]-'0')*(i-m);
}
}
if(ans==0)
cout<<"balance",pn;
else if(ans>0)
cout<<"right",pn;
else
cout<<"left"<<endl;
}
return 0;
}