stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

vector<int> g[100010];

int clr[100010];

int main(){

	int n;

	cin>>n;

	for(int i=0;i<n-1;i++){

		int a,b;

		cin>>a>>b;

		g[a].push_back(b);

		g[b].push_back(a);

	}

	memset(clr,-1,sizeof(clr));

	clr[1]=1;clr[n]=2;

	queue<int> q;

	q.push(1);q.push(n);

	while(!q.empty()){

		int x=q.front();

		q.pop();

		for(int i=0;i<g[x].size();i++){

			if(clr[g[x][i]]==-1){

				q.push(g[x][i]);

				clr[g[x][i]]=clr[x];

			}

		}

	}

	int fennec=0,snuke=0;

	for(int i=1;i<=n;i++){

		if(clr[i]==1)fennec++;

		else snuke++;

	}

	if(fennec>snuke)cout<<"Fennec"<<endl;

	else cout<<"Snuke"<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1075674873446786x):
#include<bits/stdc++.h>

using namespace std;

#define SZ(v) ((int)(v).size())

#define rep(i,n) for(int i=0;i<(n);i++)

#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)

#define all(v) (v).begin(),(v).end()

typedef long long ll;

typedef unsigned uint;

const int INF=0x3f3f3f3f;

int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)

{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}

while((uint)((c=getchar())-'0')<10);return x;}

int n;

vector<int>G[100005],ve;

int cnt[100005];

int sec=-1;

void dfs(int v,int p){

	ve.push_back(v);

	cnt[v]=1;

	if(v==n-1){

		sec=ve[(SZ(ve)+1)/2];

	}

	rep(i,SZ(G[v])){

		int to=G[v][i];

		if(to!=p){

			dfs(to,v);

			cnt[v]+=cnt[to];

		}

	}

	ve.pop_back();

}

int main(){

    cin.sync_with_stdio(false);cin.tie(0);

	cin>>n;

	rep(i,n-1){

		int u,v;

		cin>>u>>v;

		--u;--v;

		G[u].push_back(v);

		G[v].push_back(u);

	}

	dfs(0,0);

//	rep(i,n){

//		cout<<cnt[i]<<' ';

//	}

//	cout<<endl;

	bool win=(cnt[sec]*2<n);

	string ans=win?"Fennec":"Snuke";

	cout<<ans<<endl;

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

vector<int> g[100010];

int clr[100010];

int main(){

	int n;

	cin>>n;

	for(int i=0;i<n-1;i++){

		int a,b;

		cin>>a>>b;

		g[a].push_back(b);

		g[b].push_back(a);

	}

	memset(clr,-1,sizeof(clr));

	clr[1]=1;clr[n]=2;

	queue<int> q;

	q.push(1);q.push(n);

	while(!q.empty()){

		int x=q.front();

		q.pop();

		for(int i=0;i<g[x].size();i++){

			if(clr[g[x][i]]==-1){

				q.push(g[x][i]);

				clr[g[x][i]]=clr[x];

			}

		}

	}

	int fennec=0,snuke=0;

	for(int i=1;i<=n;i++){

		if(clr[i]==1)fennec++;

		else snuke++;

	}

	if(fennec>snuke)cout<<"Fennec"<<endl;

	else cout<<"Snuke"<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1455030170776357x):
#include<cstdio>

#include<vector>



const int N=100010;



int n,fa[N],dep[N],sz[N],a[N],sa,b[N],sb;

std::vector<int> G[N];



void dfs(int u)

{

	sz[u]=1;

	for(auto v:G[u])if(v^fa[u])

		fa[v]=u,dep[v]=dep[u]+1,dfs(v),sz[u]+=sz[v];

}



int main()

{

	scanf("%d",&n);

	if(n==1)

		return puts("Fennec"),0;

	for(int i=1,x,y; i<n; i++)

	{

		scanf("%d%d",&x,&y);

		G[x].push_back(y);

		G[y].push_back(x);

	}

	dfs(1);

	int lca=0;

	for(int u=1,v=n;;){

		if(dep[u]>dep[v])u=fa[u];

		else v=fa[v];

		if(u==v){

			lca=u;

			break;

		}

	}

	for(int x=1; x!=fa[lca]; x=fa[x])

		a[++sa]=x;

	for(int y=n; y!=lca; y=fa[y])

		b[++sb]=y;

	for(;sb;--sb)a[++sa]=b[sb];

	int p=a[(sa+1)/2];

	int q=a[(sa+1)/2+1];

	int s1=1,s2=0;

	if(p==fa[q])

	{

		s2=sz[q];

		s1=n-s2;

	}

	if(q==fa[p])

	{

		s1=sz[p];

		s2=n-s1;

	}

	if(s1>s2)

		puts("Fennec");

	else

		puts("Snuke");

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

vector<int> g[100010];

int clr[100010];

int main(){

	int n;

	cin>>n;

	for(int i=0;i<n-1;i++){

		int a,b;

		cin>>a>>b;

		g[a].push_back(b);

		g[b].push_back(a);

	}

	memset(clr,-1,sizeof(clr));

	clr[1]=1;clr[n]=2;

	queue<int> q;

	q.push(1);q.push(n);

	while(!q.empty()){

		int x=q.front();

		q.pop();

		for(int i=0;i<g[x].size();i++){

			if(clr[g[x][i]]==-1){

				q.push(g[x][i]);

				clr[g[x][i]]=clr[x];

			}

		}

	}

	int fennec=0,snuke=0;

	for(int i=1;i<=n;i++){

		if(clr[i]==1)fennec++;

		else snuke++;

	}

	if(fennec>snuke)cout<<"Fennec"<<endl;

	else cout<<"Snuke"<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1174611198470161x):
#include<bits/stdc++.h>

using namespace std;

int n,fat[100050],num[100050];

vector <int> V[100050];

int dfs(int now,int f)

{

	fat[now]=f;

	int tot=1;

	for(int i=0;i<V[now].size();i++)

		if(V[now][i]!=f)tot+=dfs(V[now][i],now);

	return num[now]=tot;

}

int main()

{

	cin>>n;

	for(int i=1;i<n;i++)

	{

		int x,y;

		cin>>x>>y;

		V[x].push_back(y);

		V[y].push_back(x);

	}

	num[1]=dfs(1,1);

	int z=n,sum=0;

	while(fat[z]!=z)

	{

		sum++;

		z=fat[z];

	}

	z=n;

	for(int i=1;i<=(sum-1)/2;i++)z=fat[z];

	if(num[z]>=n-num[z])cout<<"Snuke";

	else cout<<"Fennec";

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

vector<int> g[100010];

int clr[100010];

int main(){

	int n;

	cin>>n;

	for(int i=0;i<n-1;i++){

		int a,b;

		cin>>a>>b;

		g[a].push_back(b);

		g[b].push_back(a);

	}

	memset(clr,-1,sizeof(clr));

	clr[1]=1;clr[n]=2;

	queue<int> q;

	q.push(1);q.push(n);

	while(!q.empty()){

		int x=q.front();

		q.pop();

		for(int i=0;i<g[x].size();i++){

			if(clr[g[x][i]]==-1){

				q.push(g[x][i]);

				clr[g[x][i]]=clr[x];

			}

		}

	}

	int fennec=0,snuke=0;

	for(int i=1;i<=n;i++){

		if(clr[i]==1)fennec++;

		else snuke++;

	}

	if(fennec>snuke)cout<<"Fennec"<<endl;

	else cout<<"Snuke"<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1174403349804547x):
//#include<bits/stdc++.h>

//using namespace std;

//int dis[100005];

//int n;

//vector<int>vec[100005];

//void dfs(int i)

//{

//	dis[i]=1;

//	for(int j=0;j<vec[i].size();j++)

//		if(dis[vec[i][j]]==0)

//		{

//			dfs(vec[i][j]);

//			dis[i]+=dis[vec[i][j]];

//		}

//}

//vector<int>ans;

//bool vis[100005],ok;

//void dfs2(int x)

//{

//	vis[x]=1;

//	if(!ok)ans.push_back(x);

//	if(x==n)

//	{

//		ok=1;

//		return;

//	}

//	for(int i=0;i<vec[x].size();i++)

//		if(!vis[vec[x][i]])

//			dfs2(vec[x][i]);

//	if(!ok)ans.pop_back();

//}

//int main()

//{

//	cin>>n;

//	for(int i=0;i<n-1;i++)

//	{

//		int x,y;

//		cin>>x>>y;

//		vec[x].push_back(y);

//		vec[y].push_back(x);

//	}

//	dfs(1);

////	for(int i=1;i<=n;i++)

////		cout<<dis[i]<<' ';

////	cout<<endl;

//	dfs2(1);

//	int x=ans[(ans.size()+1)/2];

////	for(int i=0;i<ans.size();i++)

////		cout<<ans[i]<<' ';

////	cout<<endl;

//	x=dis[x];

//	if(x>=n-x)cout<<"Snuke";

//	else cout<<"Fennec";

//	return 0;

//}



#include<bits/stdc++.h>

using namespace std;

int n,p[100005],sz[100005];

vector<int>vec[100005];

void dfs(int x)

{

	sz[x]=1;

	for(int i=0;i<vec[x].size();i++)

	{

		if(vec[x][i]!=p[x])

		{

			p[vec[x][i]]=x;

			dfs(vec[x][i]);

			sz[x]+=sz[vec[x][i]];

		}

	}

}

int main()

{

	cin>>n;

	for(int i=0;i<n-1;i++)

	{

		int x,y;

		cin>>x>>y;

		vec[x].push_back(y);

		vec[y].push_back(x);

	}

	dfs(1);

	vector<int>path;

	int c=n,psz=0;

	while(c>0)

	{

		path.push_back(sz[c]-psz);

		psz=sz[c];

		c=p[c];

	}

	reverse(path.begin(),path.end());

	int l=0,r=0;

	int i=0,j=path.size()-1;

	while(i<=j)

	{

		l+=path[i++];

		if(i<=j)r+=path[j--];

	}

	if(l>r)cout<<"Fennec";

	else cout<<"Snuke";

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

vector<int> g[100010];

int clr[100010];

int main(){

	int n;

	cin>>n;

	for(int i=0;i<n-1;i++){

		int a,b;

		cin>>a>>b;

		g[a].push_back(b);

		g[b].push_back(a);

	}

	memset(clr,-1,sizeof(clr));

	clr[1]=1;clr[n]=2;

	queue<int> q;

	q.push(1);q.push(n);

	while(!q.empty()){

		int x=q.front();

		q.pop();

		for(int i=0;i<g[x].size();i++){

			if(clr[g[x][i]]==-1){

				q.push(g[x][i]);

				clr[g[x][i]]=clr[x];

			}

		}

	}

	int fennec=0,snuke=0;

	for(int i=1;i<=n;i++){

		if(clr[i]==1)fennec++;

		else snuke++;

	}

	if(fennec>snuke)cout<<"Fennec"<<endl;

	else cout<<"Snuke"<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.115639130867602x):
#include <bits/stdc++.h>

using namespace std;

int n;

string ss="Snuke";

string ff="Fennec";

vector<int>g[100010];

int main()

{

	cin>>n;

	for(int i=1;i<n;i++)

	{

		int x,y;

		cin>>x>>y;

		g[x].push_back(y);

		g[y].push_back(x);

	}

	vector<int>c(n+1);

	queue<int>q;

	q.push(1);q.push(n);

	c[1]=1;

	c[n]=2;

	int f=1,s=1;

	while(!q.empty())

	{

		int x=q.front();

		q.pop();

		for(int i=0;i<g[x].size();i++)

		{

			int y=g[x][i];

			if(c[y]==0)

			{

				q.push(y);

				c[y]=c[x];

				if(c[y]==1)f++;

				else s++;

			}

		}

	}

	if(f>s)cout<<ff;

	else cout<<ss;

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <string>



const int maxn = 5e5+7;



std::string s;

long long a[maxn];



int main(int argc, char *argv[]) {  

	std::ios::sync_with_stdio(false);

	std::cin.tie(0); 

	std::cin >> s;

	std::fill(a, a+maxn, 0);

	for (int i = 0; i < s.length(); i++) {

//		std::cout << s[i] << " \n"[i==s.length()-1];

		if (s[i] == '<') {

			a[i+1] = a[i]+1;

		}

	}

	for (int i = s.length(); i >= 0; i--) {

		if (s[i] == '>') {

			a[i] = std::max(a[i], a[i+1]+1);

		}

	}

	long long ans = 0;

	for (int i = 0; i <= s.length(); i++) {

//		std::cout << a[i] << " \n"[i==s.length()-1];

		ans += a[i];

	}

	std::cout << ans << '\n';

}

// Faster C++ solution for the same problem (measured speedup: 5.103015452546276x):
#include<bits/stdc++.h>

using namespace std;



int main(){

	string s;

	cin>>s;

	

	long long int len;

	len=s.size();

	

long long	i=0;

	long long int lt=0,gt=0,ans=0;

	

	while(i<len){

		

		while(i<len&&s[i]=='<'){

			lt++;

			i++;

		}

		while(i<len&&s[i]=='>'){

			gt++;

			i++;

		}

		

		if(lt==0){

			ans+=(gt*(gt+1))/2;

		}

		else if(gt==0){

			ans+=(lt*(lt+1))/2;

		}

		else{

			ans+=max(gt,lt)+((gt-1)*gt)/2+((lt-1)*lt)/2;

		}

		lt=0;gt=0;

			}

	cout<<ans;

}
// Slower C++ solution:
#include <iostream>

#include <string>



const int maxn = 5e5+7;



std::string s;

long long a[maxn];



int main(int argc, char *argv[]) {  

	std::ios::sync_with_stdio(false);

	std::cin.tie(0); 

	std::cin >> s;

	std::fill(a, a+maxn, 0);

	for (int i = 0; i < s.length(); i++) {

//		std::cout << s[i] << " \n"[i==s.length()-1];

		if (s[i] == '<') {

			a[i+1] = a[i]+1;

		}

	}

	for (int i = s.length(); i >= 0; i--) {

		if (s[i] == '>') {

			a[i] = std::max(a[i], a[i+1]+1);

		}

	}

	long long ans = 0;

	for (int i = 0; i <= s.length(); i++) {

//		std::cout << a[i] << " \n"[i==s.length()-1];

		ans += a[i];

	}

	std::cout << ans << '\n';

}

// Faster C++ solution for the same problem (measured speedup: 5.028116026239174x):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using ii = pair<ll, ll>;

#define mp make_pair

#define pb push_back

#define fi first

#define se second

const ll MOD = 1e9 + 7;

const ll N = 5e5 + 5;



string s;

ll ans;

ll a[N];



void solve() {

    cin >> s;

    for(ll i = 0; i < s.size(); i++) {

        if(s[i] == '<') a[i + 1] = a[i] + 1; 

    }

    for(ll i = s.size() - 1; i >= 0; i--) {

        if(s[i] == '>') 

            a[i] = max(a[i], a[i + 1] + 1);

    }

    ans = 0;

    for(ll i = 0; i <= s.size(); i++) {

        ans += a[i];

    }

    cout << ans << "\n";

}



int main() {

    

    ios_base::sync_with_stdio(false);

    cin.tie(0); cout.tie(0);

    

    solve();

    

}
// Slower C++ solution:
# include <bits/stdc++.h>

using namespace std;

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define pii pair<int,int>

typedef long long ll;

string s;

ll ans;

int kiri[500005],kanan[500005];

int arr[500005];

int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    cout.tie(NULL);

    cin>>s;

    memset(kiri,-1,sizeof(kiri));

    memset(kanan,-1,sizeof(kanan));

    for(int i=0;i<s.size();i++){

        if(s[i]=='<') {

            if(i!=0 && kiri[i-1]!=-1){

                kiri[i]=kiri[i-1]+1;

            }

            else kiri[i]=0;

        }

        

    }

    for(int i=s.size()-1;i>=0;i--){

        if(s[i]=='>') {

            if(kanan[i+1]!=-1){

                kanan[i]=kanan[i+1]+1;

            }

            else kanan[i]=1;

        }

        

    }

    for(int i=0;i<s.size();i++){

        if(i!=0 && kiri[i-1]!=-1 && kanan[i]!=-1){

            arr[i]=max(kiri[i-1]+1,kanan[i]);

        } 

        else if(kiri[i]!=-1) arr[i]+=kiri[i];

        else if(kanan[i]!=-1)arr[i] += kanan[i];

    }

    for(int i=0;i<=s.size()-1;i++){

        ans+=arr[i];

    }

    if(s.back()=='>') ans+=0;

    else ans+=kiri[s.size()-1]+1;

    cout<<ans<<endl;

}










// Faster C++ solution for the same problem (measured speedup: 5.007596825095725x):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using ii = pair<ll, ll>;

#define mp make_pair

#define pb push_back

#define fi first

#define se second

const ll MOD = 1e9 + 7;

const ll N = 5e5 + 5;



string s;

ll ans;

ll a[N];



void solve() {

    cin >> s;

    for(ll i = 0; i < s.size(); i++) {

        if(s[i] == '<') a[i + 1] = a[i] + 1; 

    }

    for(ll i = s.size() - 1; i >= 0; i--) {

        if(s[i] == '>') 

            a[i] = max(a[i], a[i + 1] + 1);

    }

    ans = 0;

    for(ll i = 0; i <= s.size(); i++) {

        ans += a[i];

    }

    cout << ans << "\n";

}



int main() {

    

    ios_base::sync_with_stdio(false);

    cin.tie(0); cout.tie(0);

    

    solve();

    

}
// Slower C++ solution:
#include <iostream>

#include <string>



const int maxn = 5e5+7;



std::string s;

long long a[maxn];



int main(int argc, char *argv[]) {  

	std::ios::sync_with_stdio(false);

	std::cin.tie(0); 

	std::cin >> s;

	std::fill(a, a+maxn, 0);

	for (int i = 0; i < s.length(); i++) {

//		std::cout << s[i] << " \n"[i==s.length()-1];

		if (s[i] == '<') {

			a[i+1] = a[i]+1;

		}

	}

	for (int i = s.length(); i >= 0; i--) {

		if (s[i] == '>') {

			a[i] = std::max(a[i], a[i+1]+1);

		}

	}

	long long ans = 0;

	for (int i = 0; i <= s.length(); i++) {

//		std::cout << a[i] << " \n"[i==s.length()-1];

		ans += a[i];

	}

	std::cout << ans << '\n';

}

// Faster C++ solution for the same problem (measured speedup: 5.026399013802948x):
#include<set>

#include<map>

#include<queue>

#include<stack>

#include<vector>

#include<string>

#include<cstring>

#include<iostream>

#include<algorithm>

#define fi first

#define se second

#define debug printf(" I am here\n");



using namespace std;

typedef long long ll;

typedef unsigned long long ull;

typedef pair<int,int> pii;

const ll INF=0x3f3f3f3f3f3f3f3f;

const int N = 5e5+10, mod=1e9+7;

int t, n, m; 

int a[N];

bool st[N];



int main()

{

	cin.tie(0);

	ios::sync_with_stdio(false);

	string s;

	cin >> s;

	

	int cnt = 0, d;

	for(int i = 0 ; i < s.size() ; i ++)

	{

		if(s[i] == '>')

		{

			if(cnt == 0)

				d = i;

			cnt ++;

		}

		else

		{

			if(cnt != 0)

				a[d] = cnt;

			cnt = 0;

		}

	}

	if(cnt != 0)

		a[d] = cnt;	

	

	// < >>> << > <<<<< >>> <

	int j;

	bool flag = false;

	for(int i = 0 ; i < s.size() ; i ++)

	{

		if(s[i] == '>' && s[i+1] == '<')

			a[i+1] = 0, flag = false;

		else if(s[i] == '<' && a[i+1] <= a[i])

			a[i+1] = a[i] + 1, flag = false;

		else if(s[i] == '>')

		{

			if(!flag)

			{

				for(j = i ; s[j] == '>' && j < s.size(); j ++);

				j = j - i;				

			}

			a[i+1] = j - 1;	

			j --;

			flag = true;		

		}

	

	}

	/*cout << a[0];

	for(int i = 0 ; i < s.size() ; i ++)

		cout << s[i] << a[i+1];*/

	long long sum = 0;

	for(int i = 0 ; i <= s.size() ; i ++)

		sum += a[i];

	cout << sum << endl;

}
// Slower C++ solution:
# include <bits/stdc++.h>

using namespace std;

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define pii pair<int,int>

typedef long long ll;

string s;

ll ans;

int kiri[500005],kanan[500005];

int arr[500005];

int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    cout.tie(NULL);

    cin>>s;

    memset(kiri,-1,sizeof(kiri));

    memset(kanan,-1,sizeof(kanan));

    for(int i=0;i<s.size();i++){

        if(s[i]=='<') {

            if(i!=0 && kiri[i-1]!=-1){

                kiri[i]=kiri[i-1]+1;

            }

            else kiri[i]=0;

        }

        

    }

    for(int i=s.size()-1;i>=0;i--){

        if(s[i]=='>') {

            if(kanan[i+1]!=-1){

                kanan[i]=kanan[i+1]+1;

            }

            else kanan[i]=1;

        }

        

    }

    for(int i=0;i<s.size();i++){

        if(i!=0 && kiri[i-1]!=-1 && kanan[i]!=-1){

            arr[i]=max(kiri[i-1]+1,kanan[i]);

        } 

        else if(kiri[i]!=-1) arr[i]+=kiri[i];

        else if(kanan[i]!=-1)arr[i] += kanan[i];

    }

    for(int i=0;i<=s.size()-1;i++){

        ans+=arr[i];

    }

    if(s.back()=='>') ans+=0;

    else ans+=kiri[s.size()-1]+1;

    cout<<ans<<endl;

}










// Faster C++ solution for the same problem (measured speedup: 5.005886819602727x):
#include<set>

#include<map>

#include<queue>

#include<stack>

#include<vector>

#include<string>

#include<cstring>

#include<iostream>

#include<algorithm>

#define fi first

#define se second

#define debug printf(" I am here\n");



using namespace std;

typedef long long ll;

typedef unsigned long long ull;

typedef pair<int,int> pii;

const ll INF=0x3f3f3f3f3f3f3f3f;

const int N = 5e5+10, mod=1e9+7;

int t, n, m; 

int a[N];

bool st[N];



int main()

{

	cin.tie(0);

	ios::sync_with_stdio(false);

	string s;

	cin >> s;

	

	int cnt = 0, d;

	for(int i = 0 ; i < s.size() ; i ++)

	{

		if(s[i] == '>')

		{

			if(cnt == 0)

				d = i;

			cnt ++;

		}

		else

		{

			if(cnt != 0)

				a[d] = cnt;

			cnt = 0;

		}

	}

	if(cnt != 0)

		a[d] = cnt;	

	

	// < >>> << > <<<<< >>> <

	int j;

	bool flag = false;

	for(int i = 0 ; i < s.size() ; i ++)

	{

		if(s[i] == '>' && s[i+1] == '<')

			a[i+1] = 0, flag = false;

		else if(s[i] == '<' && a[i+1] <= a[i])

			a[i+1] = a[i] + 1, flag = false;

		else if(s[i] == '>')

		{

			if(!flag)

			{

				for(j = i ; s[j] == '>' && j < s.size(); j ++);

				j = j - i;				

			}

			a[i+1] = j - 1;	

			j --;

			flag = true;		

		}

	

	}

	/*cout << a[0];

	for(int i = 0 ; i < s.size() ; i ++)

		cout << s[i] << a[i+1];*/

	long long sum = 0;

	for(int i = 0 ; i <= s.size() ; i ++)

		sum += a[i];

	cout << sum << endl;

}
// Slower C++ solution:
#include <bits/stdc++.h>

#define rep(i,n)for(long long i=0;i<(n);i++)

using namespace std;

typedef long long ll;

typedef pair<int,int> P;

 

const int MOD=1000000007;

const int INF=0x3f3f3f3f;

const ll INFL=0x3f3f3f3f3f3f3f3f;

ll gcd(ll x, ll y){

  if(y==0) return x;

  else return gcd(y, x%y);

}

ll lcm(ll x,ll y){

  ll g=gcd(x,y);

  return x/g*y;

}



int main(){

  string s;

  cin >> s;

  ll n=s.size();

  queue<ll>a;

  queue<ll>b;

  ll up=0;

  ll down=0;

  rep(i,n){

    if(i==0 &&s[0]=='>'){

      a.push(0);

      down++;

    }

    if(i!=0 &&s[i]=='>'){

      if(up){

        a.push(up);

        up=0;

      }

      down++;

    }

    if(s[i]=='<'){

      if(down){

        b.push(down);

        down=0;

      }

      up++;

    }

    if(i==n-1){

      if(up)a.push(up);

      b.push(down);

    }

  }  

  b.push(0);

    

  vector<ll>c(500010);

  c[0]=0;

  rep(i,500010) c[i+1]=c[i]+i+1;

  

  ll ans=0;

  while(!a.empty()){

    if(a.front()>=b.front()){

      ans+=c[a.front()]+c[max(b.front()-1,0ll)];

      a.pop();

      b.pop();

    }

    else{

      ans+=c[max(0ll,a.front()-1)]+c[b.front()];

      a.pop();

      b.pop();

    }

  }

  cout<<ans<<endl;

}


// Faster C++ solution for the same problem (measured speedup: 9.266386898101272x):
#include <bits/stdc++.h>

#define rep(i,n)for(long long i=0;i<(n);i++)

using namespace std;

typedef long long ll;

const int MOD=1e9+7;

const int MAX = 1000000;

const int INF = 1e9;

const double pi=acos(-1);

using namespace std;



int main(){

  string s;

  cin >> s;

  int n=s.size();

  vector<int>a(n+1,0);

  rep(i,n){

    if(s[i]=='<'){

      a[i+1]=max(a[i+1],a[i]+1);

    }

  }

  rep(i,n){

    if(s[n-1-i]=='>'){

      a[n-1-i]=max(a[n-1-i],a[n-i]+1);

    }

  }

  ll sum=0;

  rep(i,n+1)sum+=a[i];

  

  cout <<sum<<endl;

  

  return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

#define rep(i,n)for(long long i=0;i<(n);i++)

using namespace std;

typedef long long ll;

typedef pair<int,int> P;

 

const int MOD=1000000007;

const int INF=0x3f3f3f3f;

const ll INFL=0x3f3f3f3f3f3f3f3f;

ll gcd(ll x, ll y){

  if(y==0) return x;

  else return gcd(y, x%y);

}

ll lcm(ll x,ll y){

  ll g=gcd(x,y);

  return x/g*y;

}



int main(){

  string s;

  cin >> s;

  ll n=s.size();

  queue<ll>a;

  queue<ll>b;

  ll up=0;

  ll down=0;

  rep(i,n){

    if(i==0 &&s[0]=='>'){

      a.push(0);

      down++;

    }

    if(i!=0 &&s[i]=='>'){

      if(up){

        a.push(up);

        up=0;

      }

      down++;

    }

    if(s[i]=='<'){

      if(down){

        b.push(down);

        down=0;

      }

      up++;

    }

    if(i==n-1){

      if(up)a.push(up);

      b.push(down);

    }

  }  

  b.push(0);

    

  vector<ll>c(500010);

  c[0]=0;

  rep(i,500010) c[i+1]=c[i]+i+1;

  

  ll ans=0;

  while(!a.empty()){

    if(a.front()>=b.front()){

      ans+=c[a.front()]+c[max(b.front()-1,0ll)];

      a.pop();

      b.pop();

    }

    else{

      ans+=c[max(0ll,a.front()-1)]+c[b.front()];

      a.pop();

      b.pop();

    }

  }

  cout<<ans<<endl;

}


// Faster C++ solution for the same problem (measured speedup: 9.147870991188697x):
#include <bits/stdc++.h>

#define rep(i,n)for(long long i=0;i<(n);i++)

using namespace std;

using P=pair<long long,long long>;

typedef unsigned long long ull;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

 

const ll MOD=1e9+7;

const ll INF=1e18;

const double pi=acos(-1);

int dx[4]={1,0,-1,0};

int dy[4]={0,1,0,-1};





int main(){

  cin.tie(0);

  ios::sync_with_stdio(false);  

  

  string s;

  cin >> s;

  ll n=s.size()+1;

  vector<ll>vec(n);

  ll sum=0;

  rep(i,n-1){

    if(s[i]=='<'){

      vec[i]=max(sum,vec[i]);

      sum++;

    }

    else{

      vec[i]=max(sum,vec[i]);

      sum=0;

    }

  }

  vec[n-1]=max(sum,vec[n-1]);

  sum=0;

  rep(i,n-1){

    if(s[n-2-i]=='>'){

      vec[n-1-i]=max(sum,vec[n-1-i]);

      sum++;

    }

    else{

      vec[n-1-i]=max(sum,vec[n-1-i]);

      sum=0;

    }

  }

  vec[0]=max(sum,vec[0]);

  ll ans=0;

  rep(i,n){

    ans+=vec[i];

  }

  cout << ans << endl;

}
// Slower C++ solution:
#include <cstdlib>

#include <cstdio>

#include <cstdint>

#include <cstring>



inline int64_t area(int w) { return (int64_t)w*(w+1)/2; }



int main(int argc, char* argv[])

{

  int N=5e5+1;

  char s[N+1];

  int l[N+1];

  int i=scanf("%s",s);

  int g=0;

  l[g]=1;

  for (char* p=s+1;*p;p++) {

    if (*(p-1) == *p) {

      l[g]++;

    } else {

      l[++g]=1;

    }

  }



  int64_t sum=0;

  int* q=l;

  if (s[0] == '>') {

    sum = area(*q++);

  }

  for (;q<l+g;) {

    auto w1=*q++, w2=*q++;

    if (w1 < w2) { w1--; } else { w2--; }

    sum += area(w1) + area(w2);

  }

  if (*q) {

    sum += area(*q);

  }

  printf("%ld\n", sum);

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1848606266942516x):
#include <cstdlib>

#include <cstdio>

#include <cstdint>

#include <cstring>



const int N=5e5;

inline auto a(int64_t w) { return w*(w-1)/2; }

inline char* l(char* p, int s) { for(;*p==s;p++); return p; }



main(int argc, char* argv[])

{

  char s[N+1];

  int64_t sum=0, i=scanf("%s",s);

  char *p,*q,*r;

  for (p=s;*p;p=r) {

    q=l(p,'<'), r=l(q,'>');

    int m=q-p, n=r-q;

    sum += a(m) + a(n) + ((m>n)?m:n);

  }

  printf("%ld\n", sum);

}