#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define pob pop_back
#define vl vector<ll>
#define mp make_pair
#define sz size()
#define fast ios::sync_with_stdio(0)
#define maxx 100005
#define mod 1000000007
#define edge pair<ll,ll>
using namespace std;

// ¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++¦¦¦++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++¦¦¦¦¦¦¦¦¦¦+++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++¦¦¦¦¦+++++++¦++¦¦
// ¦¦¦¦¦¦¦¦++¦¦¦¦¦¦++++++¦¦¦¦+++++++++++++¦
// ¦¦¦¦¦¦¦++++++¦¦¦++++++¦¦++++++++++++++¦¦
// ¦¦¦¦¦¦¦+++++++¦¦¦+++++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++¦¦¦¦¦¦¦¦¦++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++¦¦¦¦¦¦¦¦+++++++¦
// ¦¦¦¦¦¦¦¦¦¦++¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦++++¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++¦¦+¦++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++¦¦+++++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+¦¦¦¦+++¦¦¦¦++++++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++¦¦+¦¦¦¦¦+++++++¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++++++¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+¦¦¦+++++++++++¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++¦¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++¦¦¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++¦¦¦¦¦¦¦¦¦¦¦¦

int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		ll	a[n];
		ll i;
		for(i=1;i<=n;i++)
		{
			cin>>a[i];
		}
		ll cnt[n+1]={0};
		ll m;
		ll j;
		ll l=0,r=0;
		for(i=1;i<=n;i++)
		{
			l=0;
			r=1;
			m=a[i];
			j=i+1;
			while(j<=n && r<=m)
			{
				if(a[i]>a[j])
				r++;
				else
				break;
				j++;
			}
			j=i-1;
			while(j>=1 && l<=m)
			{
				if(a[i]>a[j])
				l++;
				else
				break;
				j--;
			}
			if(l+r==m)
			{
				cnt[m]++;
			}
		}
		for(i=1;i<=n;i++)
		{
			cout<<cnt[i];
		}
		cout<<endl;
	}

}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define pob pop_back
#define vl vector<ll>
#define mp make_pair
#define sz size()
#define fast ios::sync_with_stdio(0)
#define maxx 100005
#define mod 1000000007
#define edge pair<ll,ll>
using namespace std;

// ¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++¦¦¦++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++¦¦¦¦¦¦¦¦¦¦+++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++¦¦¦¦¦+++++++¦++¦¦
// ¦¦¦¦¦¦¦¦++¦¦¦¦¦¦++++++¦¦¦¦+++++++++++++¦
// ¦¦¦¦¦¦¦++++++¦¦¦++++++¦¦++++++++++++++¦¦
// ¦¦¦¦¦¦¦+++++++¦¦¦+++++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++¦¦¦¦¦¦¦¦¦++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++¦¦¦¦¦¦¦¦+++++++¦
// ¦¦¦¦¦¦¦¦¦¦++¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦++++¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++¦¦+¦++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++¦¦+++++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+¦¦¦¦+++¦¦¦¦++++++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++¦¦+¦¦¦¦¦+++++++¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++++++¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+¦¦¦+++++++++++¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++¦¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++¦¦¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++¦¦¦¦¦¦¦¦¦¦¦¦

int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		ll	a[n];
		ll i;
		for(i=1;i<=n;i++)
		{
			cin>>a[i];
		}
		ll cnt[n+1]={0};
		ll m;
		ll j;
		ll l=0,r=0;
		for(i=1;i<=n;i++)
		{
			l=0;
			r=1;
			m=a[i];
			j=i+1;
			while(j<=n && r<=m)
			{
				if(a[i]>a[j])
				r++;
				else
				break;
				j++;
			}
			j=i-1;
			if(r<m)
			while(j>=1 && l<=m)
			{
				if(a[i]>a[j])
				l++;
				else
				break;
				j--;
			}
			if(l+r==m)
			{
				cnt[m]++;
			}
		}
		for(i=1;i<=n;i++)
		{
			cout<<cnt[i];
		}
		cout<<endl;
	}

}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define pob pop_back
#define vl vector<ll>
#define mp make_pair
#define sz size()
#define fast ios::sync_with_stdio(0)
#define maxx 100005
#define mod 1000000007
#define edge pair<ll,ll>
using namespace std;

// ¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++¦¦¦++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++¦¦¦¦¦¦¦¦¦¦+++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++¦¦¦¦¦+++++++¦++¦¦
// ¦¦¦¦¦¦¦¦++¦¦¦¦¦¦++++++¦¦¦¦+++++++++++++¦
// ¦¦¦¦¦¦¦++++++¦¦¦++++++¦¦++++++++++++++¦¦
// ¦¦¦¦¦¦¦+++++++¦¦¦+++++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++¦¦¦¦¦¦¦¦¦++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++¦¦¦¦¦¦¦¦+++++++¦
// ¦¦¦¦¦¦¦¦¦¦++¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦++++¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++¦¦+¦++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++¦¦+++++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+¦¦¦¦+++¦¦¦¦++++++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++¦¦+¦¦¦¦¦+++++++¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++++++¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+¦¦¦+++++++++++¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++¦¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++¦¦¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++¦¦¦¦¦¦¦¦¦¦¦¦

int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		ll i;
		cin>>n;
		ll a[n];
		ll pos[n];

		for(i=1;i<=n;i++)
		{
			cin>>a[i];
			pos[a[i]]=i;
		}
		ll l,r;
		string ans="1";
		l=r=pos[1];
		for(i=2;i<=n;i++)
		{
			l=min(l,pos[i]);
			r=max(r,pos[i]);
			if(r-l+1==i)
			ans=ans+'1';
			else
			ans=ans+'0';
		}
		cout<<ans<<endl;
	}
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define pob pop_back
#define vl vector<ll>
#define mp make_pair
#define sz size()
#define fast ios::sync_with_stdio(0)
#define maxx 100005
#define mod 1000000007
#define edge pair<ll,ll>
using namespace std;

// ¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++¦¦¦++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++¦¦¦¦¦¦¦¦¦¦+++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++¦¦¦¦¦+++++++¦++¦¦
// ¦¦¦¦¦¦¦¦++¦¦¦¦¦¦++++++¦¦¦¦+++++++++++++¦
// ¦¦¦¦¦¦¦++++++¦¦¦++++++¦¦++++++++++++++¦¦
// ¦¦¦¦¦¦¦+++++++¦¦¦+++++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++¦¦¦¦¦¦¦¦¦++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++¦¦¦¦¦¦¦¦+++++++¦
// ¦¦¦¦¦¦¦¦¦¦++¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦++++¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++¦¦+¦++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++¦¦+++++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+¦¦¦¦+++¦¦¦¦++++++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++¦¦+¦¦¦¦¦+++++++¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++++++¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+¦¦¦+++++++++++¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++¦¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++¦¦¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++¦¦¦¦¦¦¦¦¦¦¦¦

int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		ll	a[n];
		ll i;
		for(i=1;i<=n;i++)
		{
			cin>>a[i];
		}
		ll cnt[n+1]={0};
		ll m;
		ll j,k,o=0,e=0;
		ll l=0,r=0;
		for(i=1;i<=n;i++)
		{
			l=0;
			e=0;
			o=0;
			r=1;
			m=a[i];
			j=i+1;
			k=i-1;
			while((j<=n) || k>=1)
			{
				if(a[i]>a[j])
				{
					j++;
					r++;
				}
				if(a[k]<a[i])
				{
					l++;
					k--;
				}
				if(a[i]<a[k])
				{
					e++;
				}
				if(a[i]<a[j])
				{
					o++;
				}
				if(o>0 && e>0)
				break;
				if(l+r>=m)
				break;
			}
			if(l+r==m)
			cnt[m]++;

		}
		for(i=1;i<=n;i++)
		{
			cout<<cnt[i];
		}
		cout<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
#define sf scanf
#define pf printf
#define pb push_back
#define pii pair<int,int>
#define pob pop_back
#define all(a) a.begin(),a.end()
#define fio ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define i64 long long int
#define mem(x,y) memset(x,y,sizeof(x))
#define fill(arr,b) fill(arr, arr+sizeof(arr)/sizeof(arr[0]), b)

const double pi = acos(-1.0);
const int maxn = (i64)2e5+5;

int main(){
    freopen("input.txt","r",stdin);
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int i,j;
        int arr[10];
        bool chk[10] = {0};
        for(i = 1 ; i<=n ; i++)
        {
            cin>>j;
            arr[j] = i;
        }
        cout<<'1';
        int mx = 0;
        int mn = arr[1];
        for(i = 2 ; i<n ; i++)
        {
            mx = max(mx,arr[i]);
            mn = min(mn,arr[i]);
            if(max(mx,arr[i])-min(mn,arr[i]) == i-1) cout<<'1';
            else cout<<'0';
        }
        cout<<'1'<<endl;
    }
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define sf scanf
#define pf printf
#define pb push_back
#define pii pair<int,int>
#define pob pop_back
#define all(a) a.begin(),a.end()
#define fio ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define i64 long long int
#define mem(x,y) memset(x,y,sizeof(x))
#define fill(arr,b) fill(arr, arr+sizeof(arr)/sizeof(arr[0]), b)

const double pi = acos(-1.0);
const int maxn = (i64)2e5+5;
int arr[200007];
int main(){
    freopen("input.txt","r",stdin);
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int i,j;

        for(i = 1 ; i<=n ; i++)
        {
            cin>>j;
            arr[j] = i;
        }
        cout<<'1';
        int mx = 0;
        int mn = arr[1];
        for(i = 2 ; i<n ; i++)
        {

            if(max(mx,arr[i])-min(mn,arr[i]) == i-1) cout<<'1';
            else cout<<'0';
            mx = max(mx,arr[i]);
            mn = min(mn,arr[i]);
        }
        if(n>1)cout<<"1"<<endl;
        else cout<<endl;
    }
return 0;
}


#include <bits/stdc++.h>
using namespace std;
int was[100];
int main(){
      string s;
      cin >>s;
      s+='c';
      for (int i=0; i<s.size()-1; i++){
            if (s[i] > s[i+1]) return cout <<"NO" , 0;
            was[s[i]-'a'+1]++;
      }
      if (was[1] == 0 || was[2] == 0) return cout <<"NO" , 0;
      if (was[3] != was[1] && was[3] != was[2]) return cout <<"NO" , 0;
      cout <<"YES";
      return 0;
}


#include <bits/stdc++.h>
#define f first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define ull unsigned long long
using namespace std;
const int inf = (int)(1e9+7);
const double pi = 3.14159265359;
const int MAXN = 100100;
void boost(){
	ios_base :: sync_with_stdio(false);

	cin.tie(0);

	cout.tie(0);
}
void file(){
	freopen(".in"  , "r" , stdin);
	freopen(".out" , "w" , stdout);
}
int cnt[100];
int main(){
	boost();
//	file();
	string s;
//	int ;
	cin >> s;
	for (int i=0; i<s.size(); i++) cnt[s[i]-'a'+1]++;
	if (cnt[1] + cnt[2] + cnt[3] != s.size())
		return cout <<"NO" , 0;

	if (cnt[3] != cnt[1] && cnt[3] != cnt[2])
		return cout <<"NO" , 0;

	for (int i=0; i<s.size()-1; i++)
		if (s[i] > s[i+1])
			return cout <<"NO" , 0;
	cout <<"YES";
	return 0;
}
/**/


#include <bits/stdc++.h>
using namespace std;
int was[100];
int main(){
      string s;
      cin >>s;
      s+='c';
      for (int i=0; i<s.size()-1; i++){
            if (s[i] > s[i+1]) return cout <<"NO" , 0;
            was[s[i]-'a'+1]++;
      }
      // cout <<was[3]<<endl;
      if (was[3] != was[1] && was[3] != was[2]) return cout <<"NO" , 0;
      cout <<"YES";
      return 0;
}


/*
 * Aishwariya Singha Roy (RiuSRoy), NitS
*/
#include <bits/stdc++.h>
#define ll long long
#define loop(i,s,e) for (ll i=s;i<=e;i++)
#define pool(i,s,e) for(ll i=s;i>=e;i--)
#define riu() ll t;cin>>t;while(t--)
#define vis(v,size) vector <ll> v(size);
#define vi(v) std::vector<ll> v;
#define pii pair<ll,ll>
#define pb(n) push_back(n)
#define mp(a,b) make_pair(a,b)
#define fill(a,value) memset(a,value,sizeof(a))
#define MOD 1000000007
#define vit vector<ll>::iterator
#define tr(itr,adj,v) for(vit itr = adj[v].begin(); itr!=adj[v].end(); ++itr)
#define PI  3.14159265358979323846
#define MAX 200005
#define vpi(v) vector <pair <ll,ll> > v
#define debug() cout<<"######"<<endl
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  ll n = s.length();
  ll a_end = -1;
  loop(i,0,n-1)
  {
    if(s[i] != 'a')
    {
      a_end = i-1;
      break;
    }
  }
  if(a_end == -1)
  {
    cout << "NO" << endl;
    return 0;
  }
  if(s[a_end + 1] != 'b')
  {
    cout << "NO" << endl;
    return 0;
  }
  ll b_end = -1;
  loop(i,a_end+1,n-1)
  {
    if(s[i] != 'b')
    {
      b_end = i-1;
      break;
    }
  }
  if(b_end == -1)
  {
    cout << "NO" << endl;
    return 0;
  }
  if(s[b_end + 1] != 'c')
  {
    cout << "NO" << endl;
    return 0;
  }
  ll cnt_C = count(s.begin(), s.end(),'c');
  ll cnt_B = count(s.begin(), s.end(),'b');
  ll cnt_A = count(s.begin(), s.end(),'a');
  if(n-1-b_end != cnt_C)
  {
    cout << "NO" << endl;
    return 0;
  }
  if(b_end - a_end == cnt_C || (a_end+1 == cnt_C))
  {
    cout << "YES" << endl;
  }
  else
  cout << "NO" << endl;
  return 0;
}


/*
 * Aishwariya Singha Roy (RiuSRoy), NitS
*/
#include <bits/stdc++.h>
#define ll long long
#define loop(i,s,e) for (ll i=s;i<=e;i++)
#define pool(i,s,e) for(ll i=s;i>=e;i--)
#define riu() ll t;cin>>t;while(t--)
#define vis(v,size) vector <ll> v(size);
#define vi(v) std::vector<ll> v;
#define pii pair<ll,ll>
#define pb(n) push_back(n)
#define mp(a,b) make_pair(a,b)
#define fill(a,value) memset(a,value,sizeof(a))
#define MOD 1000000007
#define vit vector<ll>::iterator
#define tr(itr,adj,v) for(vit itr = adj[v].begin(); itr!=adj[v].end(); ++itr)
#define PI  3.14159265358979323846
#define MAX 200005
#define vpi(v) vector <pair <ll,ll> > v
#define debug() cout<<"######"<<endl
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  ll n = s.length();
  ll a_end = -1;
  loop(i,0,n-1)
  {
    if(s[i] != 'a')
    {
      a_end = i-1;
      break;
    }
  }
  if(a_end == -1)
  {
    cout << "NO" << endl;
    return 0;
  }
  if(s[a_end + 1] != 'b')
  {
    cout << "NO" << endl;
    return 0;
  }
  ll b_end = -1;
  loop(i,a_end+1,n-1)
  {
    if(s[i] != 'b')
    {
      b_end = i-1;
      break;
    }
  }
  if(b_end == -1)
  {
    cout << "NO" << endl;
    return 0;
  }
  if(s[b_end + 1] != 'c')
  {
    cout << "NO" << endl;
    return 0;
  }
  if(((a_end + 1) == (n-1-b_end)) || ((n-1-b_end) == (b_end - a_end)))
  {
    cout << "YES" << endl;
  }
  else
  cout << "NO" << endl;
  return 0;
}


/*
 * Aishwariya Singha Roy (RiuSRoy), NitS
*/
#include <bits/stdc++.h>
#define ll long long
#define loop(i,s,e) for (ll i=s;i<=e;i++)
#define pool(i,s,e) for(ll i=s;i>=e;i--)
#define riu() ll t;cin>>t;while(t--)
#define vis(v,size) vector <ll> v(size);
#define vi(v) std::vector<ll> v;
#define pii pair<ll,ll>
#define pb(n) push_back(n)
#define mp(a,b) make_pair(a,b)
#define fill(a,value) memset(a,value,sizeof(a))
#define MOD 1000000007
#define vit vector<ll>::iterator
#define tr(itr,adj,v) for(vit itr = adj[v].begin(); itr!=adj[v].end(); ++itr)
#define PI  3.14159265358979323846
#define MAX 200005
#define vpi(v) vector <pair <ll,ll> > v
#define debug() cout<<"######"<<endl
using namespace std;

ll a,b,c;
int main()
{
  ios_base::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  ll n = s.length();
  loop(i,0,n-1)
  {
    if(s[i]=='a')
    {
      if(b || c)
      {
          cout<<"NO" << endl;
          return 0;
      }
      a++;
    }
    else if(s[i]=='b')
    {
      if(!a || c)
      {
          cout << "NO" << endl;
          return 0;
      }
      b++;
    }
    else
    {
      if(!a || !b)
      {
          cout << "NO" << endl;
          return 0;
      }
      c++;
    }
  }
  if(!a || !b || !c)
  {
    cout << "NO" << endl;
    return 0;
  }
  if(c == a || c == b)
  {
    cout << "YES" << endl;
    return 0;
  }
  cout << "NO" << endl;
  return 0;
}


/*
 * Aishwariya Singha Roy (RiuSRoy), NitS
*/
#include <bits/stdc++.h>
#define ll long long
#define loop(i,s,e) for (ll i=s;i<=e;i++)
#define pool(i,s,e) for(ll i=s;i>=e;i--)
#define riu() ll t;cin>>t;while(t--)
#define vis(v,size) vector <ll> v(size);
#define vi(v) std::vector<ll> v;
#define pii pair<ll,ll>
#define pb(n) push_back(n)
#define mp(a,b) make_pair(a,b)
#define fill(a,value) memset(a,value,sizeof(a))
#define MOD 1000000007
#define vit vector<ll>::iterator
#define tr(itr,adj,v) for(vit itr = adj[v].begin(); itr!=adj[v].end(); ++itr)
#define PI  3.14159265358979323846
#define MAX 200005
#define vpi(v) vector <pair <ll,ll> > v
#define debug() cout<<"######"<<endl
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  ll n = s.length();
  ll a_end = -1;
  loop(i,0,n-1)
  {
    if(s[i] != 'a')
    {
      a_end = i-1;
      break;
    }
  }
  if(a_end == -1)
  {
    cout << "NO" << endl;
    return 0;
  }
  if(s[a_end + 1] != 'b')
  {
    cout << "NO" << endl;
    return 0;
  }
  ll b_end = -1;
  loop(i,a_end+1,n-1)
  {
    if(s[i] != 'b')
    {
      b_end = i-1;
      break;
    }
  }
  if(b_end == -1)
  {
    cout << "NO" << endl;
    return 0;
  }
  if(s[b_end + 1] != 'c')
  {
    cout << "NO" << endl;
    return 0;
  }
  if((a_end + 1) != (n-1-b_end))
  {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  return 0;
}


/*
 * Aishwariya Singha Roy (RiuSRoy), NitS
*/
#include <bits/stdc++.h>
#define ll long long
#define loop(i,s,e) for (ll i=s;i<=e;i++)
#define pool(i,s,e) for(ll i=s;i>=e;i--)
#define riu() ll t;cin>>t;while(t--)
#define vis(v,size) vector <ll> v(size);
#define vi(v) std::vector<ll> v;
#define pii pair<ll,ll>
#define pb(n) push_back(n)
#define mp(a,b) make_pair(a,b)
#define fill(a,value) memset(a,value,sizeof(a))
#define MOD 1000000007
#define vit vector<ll>::iterator
#define tr(itr,adj,v) for(vit itr = adj[v].begin(); itr!=adj[v].end(); ++itr)
#define PI  3.14159265358979323846
#define MAX 200005
#define vpi(v) vector <pair <ll,ll> > v
#define debug() cout<<"######"<<endl
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  ll n = s.length();
  ll a_end = -1;
  loop(i,0,n-1)
  {
    if(s[i] != 'a')
    {
      a_end = i-1;
      break;
    }
  }
  if(a_end == -1)
  {
    cout << "NO" << endl;
    return 0;
  }
  if(s[a_end + 1] != 'b')
  {
    cout << "NO" << endl;
    return 0;
  }
  ll b_end = -1;
  loop(i,a_end+1,n-1)
  {
    if(s[i] != 'b')
    {
      b_end = i-1;
      break;
    }
  }
  if(b_end == -1)
  {
    cout << "NO" << endl;
    return 0;
  }
  if(s[b_end + 1] != 'c')
  {
    cout << "NO" << endl;
    return 0;
  }
  ll cnt_C = count(s.begin(), s.end(),'c');
  ll cnt_B = count(s.begin(), s.end(),'b');
  ll cnt_A = count(s.begin(), s.end(),'a');
  if(cnt_B == cnt_C || (cnt_A == cnt_C))
  {
    cout << "YES" << endl;
  }
  else
  cout << "NO" << endl;
  return 0;
}


/*
 * Aishwariya Singha Roy (RiuSRoy), NitS
*/
#include <bits/stdc++.h>
#define ll long long
#define loop(i,s,e) for (ll i=s;i<=e;i++)
#define pool(i,s,e) for(ll i=s;i>=e;i--)
#define riu() ll t;cin>>t;while(t--)
#define vis(v,size) vector <ll> v(size);
#define vi(v) std::vector<ll> v;
#define pii pair<ll,ll>
#define pb(n) push_back(n)
#define mp(a,b) make_pair(a,b)
#define fill(a,value) memset(a,value,sizeof(a))
#define MOD 1000000007
#define vit vector<ll>::iterator
#define tr(itr,adj,v) for(vit itr = adj[v].begin(); itr!=adj[v].end(); ++itr)
#define PI  3.14159265358979323846
#define MAX 200005
#define vpi(v) vector <pair <ll,ll> > v
#define debug() cout<<"######"<<endl
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  ll n = s.length();
  ll a_end = -1;
  loop(i,0,n-1)
  {
    if(s[i] != 'a')
    {
      a_end = i-1;
      break;
    }
  }
  if(a_end == -1)
  {
    cout << "NO" << endl;
    return 0;
  }
  if(s[a_end + 1] != 'b')
  {
    cout << "NO" << endl;
    return 0;
  }
  ll b_end = -1;
  loop(i,a_end+1,n-1)
  {
    if(s[i] != 'b')
    {
      b_end = i-1;
      break;
    }
  }
  if(b_end == -1)
  {
    cout << "NO" << endl;
    return 0;
  }
  if(s[b_end + 1] != 'c')
  {
    cout << "NO" << endl;
    return 0;
  }
  ll cnt_C = count(s.begin(), s.end(),'c');
  if((a_end + 1) == cnt_C || ((n-1-b_end) == cnt_C))
  {
    cout << "YES" << endl;
  }
  else
  cout << "NO" << endl;
  return 0;
}


/*
 * Aishwariya Singha Roy (RiuSRoy), NitS
*/
#include <bits/stdc++.h>
#define ll long long
#define loop(i,s,e) for (ll i=s;i<=e;i++)
#define pool(i,s,e) for(ll i=s;i>=e;i--)
#define riu() ll t;cin>>t;while(t--)
#define vis(v,size) vector <ll> v(size);
#define vi(v) std::vector<ll> v;
#define pii pair<ll,ll>
#define pb(n) push_back(n)
#define mp(a,b) make_pair(a,b)
#define fill(a,value) memset(a,value,sizeof(a))
#define MOD 1000000007
#define vit vector<ll>::iterator
#define tr(itr,adj,v) for(vit itr = adj[v].begin(); itr!=adj[v].end(); ++itr)
#define PI  3.14159265358979323846
#define MAX 200005
#define vpi(v) vector <pair <ll,ll> > v
#define debug() cout<<"######"<<endl
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  ll n = s.length();
  ll a_end = -1;
  loop(i,0,n-1)
  {
    if(s[i] != 'a')
    {
      a_end = i-1;
      break;
    }
  }
  if(a_end == -1)
  {
    cout << "NO" << endl;
    return 0;
  }
  if(s[a_end + 1] != 'b')
  {
    cout << "NO" << endl;
    return 0;
  }
  ll b_end = -1;
  loop(i,a_end+1,n-1)
  {
    if(s[i] != 'b')
    {
      b_end = i-1;
      break;
    }
  }
  if(b_end == -1)
  {
    cout << "NO" << endl;
    return 0;
  }
  if(s[b_end + 1] != 'c')
  {
    cout << "NO" << endl;
    return 0;
  }
  if((a_end + 1) == (n-1-b_end) || (n-1-b_end) == (b_end - a_end))
  {
    cout << "YES" << endl;
    return 0;
  }
  else
  cout << "NO" << endl;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    cin >> s;

    int a = 0, b = 0, c = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == 'a') a++;
        else if (s[i] == 'b') b++;
        else if (s[i] == 'c') c++;
    }

    if (c == a || c == b || c == a + b)
    {
        // check
        bool bflag = true, cflag = true;
        for (int i = 1; i < s.size(); i++)
        {
            if (s[i] == 'a' && s[i - 1] != 'a')
            {
                puts("NO");
                return 0;
            }
            else if (s[i] == 'b' && s[i - 1] == 'a')
            {
                if (bflag)
                {
                    bflag = false;
                }
                else
                {
                    puts("NO");
                    return 0;
                }
            }
            else if (s[i] == 'b' && s[i - 1] == 'c')
            {
                puts("NO");
                return 0;
            }
            else if (s[i] == 'c' && s[i - 1] == 'b')
            {
                if (cflag)
                {
                    cflag = false;
                }
                else
                {
                    puts("NO");
                }
            }
            else if (s[i] == 'c' && s[i - 1] == 'a')
            {
                puts("NO");
                return 0;
            }
            puts("YES");
        }
    }
    else
        {
            puts("NO");
        }
}


#include<bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int a = 0, b = 0, c = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'a') a++;
    if (s[i] == 'b') b++;
    if (s[i] == 'c') c++;
  }
  string t = s;
  sort(t.begin(), t.end());
  if (t != s) puts("NO");
  else {
    if (a == c || b == c) puts("YES");
    else puts("NO");
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    cin >> s;

    int a = 0, b = 0, c = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == 'a') a++;
        else if (s[i] == 'b') b++;
        else if (s[i] == 'c') c++;
    }

    if (c == a || c == b || c == a + b)
    {
        // check
        bool bflag = true, cflag = true;
        for (int i = 1; i < s.size(); i++)
        {
            if (s[i] == 'a' && s[i - 1] != 'a')
            {
                puts("NO");
                return 0;
            }
            else if (s[i] == 'b' && s[i - 1] == 'a')
            {
                if (bflag)
                {
                    bflag = false;
                }
                else
                {
                    puts("NO");
                    return 0;
                }
            }
            else if (s[i] == 'b' && s[i - 1] == 'c')
            {
                puts("NO");
                return 0;
            }
            else if (s[i] == 'c' && s[i - 1] == 'b')
            {
                if (cflag)
                {
                    cflag = false;
                }
                else
                {
                    puts("NO");
                }
            }
            else if (s[i] == 'c' && s[i - 1] == 'a')
            {
                puts("NO");
                return 0;
            }
        }

        puts("YES");
    }
}


#include<bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int a = 0, b = 0, c = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'a') a++;
    if (s[i] == 'b') b++;
    if (s[i] == 'c') c++;
  }
  bool ok = false;
  if (s[0] == 'a') ok = true;
  if (c == 0) {
    if (c == a && !ok) puts("YES");
    else if (c == b && ok) puts("YES");
    else puts("NO");
  } else {
    if (c == a && ok) puts("YES");
    else if (c == b && ok) puts("YES");
    else if (c == b && !ok && a == 0) puts("YES");
    else puts("NO");
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    cin >> s;

    int a = 0, b = 0, c = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == 'a') a++;
        else if (s[i] == 'b') b++;
        else if (s[i] == 'c') c++;
    }

    if (c == a || c == b)
    {
        // check
        bool bflag = true, cflag = true;
        for (int i = 1; i < s.size(); i++)
        {
            if (s[i] == 'a' && s[i - 1] != 'a')
            {
                puts("NO");
                return 0;
            }
            else if (s[i] == 'b' && s[i - 1] == 'a')
            {
                if (bflag)
                {
                    bflag = false;
                }
                else
                {
                    puts("NO");
                    return 0;
                }
            }
            else if (s[i] == 'b' && s[i - 1] == 'c')
            {
                puts("NO");
                return 0;
            }
            else if (s[i] == 'c' && s[i - 1] == 'b')
            {
                if (cflag)
                {
                    cflag = false;
                }
                else
                {
                    puts("NO");
                }
            }
            else if (s[i] == 'c' && s[i - 1] == 'a')
            {
                puts("NO");
                return 0;
            }
        }

        puts("YES");
    }
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    cin >> s;

    int a = 0, b = 0, c = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == 'a') a++;
        else if (s[i] == 'b') b++;
        else if (s[i] == 'c') c++;
    }

    if (c == a || c == b || c == a + b)
    {
        // check
        bool bflag = true, cflag = true;
        for (int i = 1; i < s.size(); i++)
        {
            if (s[i] == 'a' && s[i - 1] != 'a')
            {
                puts("NO");
                return 0;
            }
            else if (s[i] == 'b' && s[i - 1] == 'a')
            {
                if (bflag)
                {
                    bflag = false;
                }
                else
                {
                    puts("NO");
                    return 0;
                }
            }
            else if (s[i] == 'b' && s[i - 1] == 'c')
            {
                puts("NO");
                return 0;
            }
            else if (s[i] == 'c' && s[i - 1] == 'b')
            {
                if (cflag)
                {
                    cflag = false;
                }
                else
                {
                    puts("NO");
                }
            }
            else if (s[i] == 'c' && s[i - 1] == 'a')
            {
                puts("NO");
                return 0;
            }
        }
        puts("YES");
    }
    else
        {
            puts("NO");
        }
}


#include<bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int a = 0, b = 0, c = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'a') a++;
    if (s[i] == 'b') b++;
    if (s[i] == 'c') c++;
  }
  string t = s;
  sort(t.begin(), t.end());
  if (t != s || a == 0 || b == 0) puts("NO");
  else {
    if (a == c || b == c) puts("YES");
    else puts("NO");
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    cin >> s;

    int a = 0, b = 0, c = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == 'a') a++;
        else if (s[i] == 'b') b++;
        else if (s[i] == 'c') c++;
    }

    if (c == a || c == b || c == a + b)
    {
        // check
        bool bflag = true, cflag = true;
        for (int i = 1; i < s.size(); i++)
        {
            if (s[i] == 'a' && s[i - 1] != 'a')
            {
                puts("NO");
                return 0;
            }
            else if (s[i] == 'b' && s[i - 1] == 'a')
            {
                if (bflag)
                {
                    bflag = false;
                }
                else
                {
                    puts("NO");
                    return 0;
                }
            }
            else if (s[i] == 'b' && s[i - 1] == 'c')
            {
                puts("NO");
                return 0;
            }
            else if (s[i] == 'c' && s[i - 1] == 'b')
            {
                if (cflag)
                {
                    cflag = false;
                }
                else
                {
                    puts("NO");
                }
            }
            else if (s[i] == 'c' && s[i - 1] == 'a')
            {
                puts("NO");
                return 0;
            }
            puts("YES");
        }
        else
        {
            puts("NO");
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

long long int MOD=1e9 +7;

long long int n,m,k;
 long long int ans=0;
  vector< vector<long long int> >ar(30,vector<long long int>(30));
long long fast_exp(long long int base,long long int ex) {
    long long res=1;
    while(ex>0) {
       if(ex%2==1) res=(res*base)%MOD;
       base=(base*base)%MOD;
       ex/=2;
    }
    return res%MOD;
}
long long int gcd(long long int a, long long int b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}

 void  dfs(int i, int j, long long int pa)
 {
     if(i==n&&j==m){
         pa^=ar[i][j];
         if(pa==k)ans++;return;
     }
     if(i!=1||j!=1)
     pa=pa^ar[i][j];
     if(i+1<=n)dfs(i+1,j,pa);
     if(j+1<=m)dfs(i,j+1,pa);
     return ;
 }
int main() {

    string s;
    cin>>s;
    int a=-1;int b=-1;int c=-1;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='a'&&a==-1)a=i;
        if(s[i]=='b'&&b==-1)b=i;
        if(s[i]=='c'&&c==-1)c=i;
    }
    if(a<b&&b<c)
    {
        int q=0,w=0,e=0;
        for(int i=0;i<n;i++)
        {
            if(s[i]=='a')q++;
            if(s[i]=='b')w++;
            if(s[i]=='c')e++;
        }
        if(q==e||w==e)
        {
            cout<<"YES\n";return 0;
        }
    }
    cout<<"NO\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

long long int MOD=1e9 +7;

long long int n,m,k;
 long long int ans=0;
  vector< vector<long long int> >ar(30,vector<long long int>(30));
long long fast_exp(long long int base,long long int ex) {
    long long res=1;
    while(ex>0) {
       if(ex%2==1) res=(res*base)%MOD;
       base=(base*base)%MOD;
       ex/=2;
    }
    return res%MOD;
}
long long int gcd(long long int a, long long int b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}

 void  dfs(int i, int j, long long int pa)
 {
     if(i==n&&j==m){
         pa^=ar[i][j];
         if(pa==k)ans++;return;
     }
     if(i!=1||j!=1)
     pa=pa^ar[i][j];
     if(i+1<=n)dfs(i+1,j,pa);
     if(j+1<=m)dfs(i,j+1,pa);
     return ;
 }
int main() {

    string s;
    cin>>s;
    int a=-1;int b=-1;int c=-1;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='a')a=i;
        if(s[i]=='b')b=i;
        if(s[i]=='c')c=i;
    }
    if(a<b&&b<c)
    {
        int q=0,w=0,e=0;
        for(int i=0;i<n;i++)
        {
            if(s[i]=='a')q++;
            if(s[i]=='b')w++;
            if(s[i]=='c')e++;
        }
        if(q==e||w==e)
        {
            cout<<"YES\n";return 0;
        }
    }
    cout<<"NO\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

long long int MOD=1e9 +7;

long long int n,m,k;
 long long int ans=0;
  vector< vector<long long int> >ar(30,vector<long long int>(30));
long long fast_exp(long long int base,long long int ex) {
    long long res=1;
    while(ex>0) {
       if(ex%2==1) res=(res*base)%MOD;
       base=(base*base)%MOD;
       ex/=2;
    }
    return res%MOD;
}
long long int gcd(long long int a, long long int b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}

 void  dfs(int i, int j, long long int pa)
 {
     if(i==n&&j==m){
         pa^=ar[i][j];
         if(pa==k)ans++;return;
     }
     if(i!=1||j!=1)
     pa=pa^ar[i][j];
     if(i+1<=n)dfs(i+1,j,pa);
     if(j+1<=m)dfs(i,j+1,pa);
     return ;
 }
int main() {

    string s;
    cin>>s;
    int a=-1;int b=-1;int c=-1;
    int a1--1,b1=-1,c1=-1;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='a'&&a==-1)a=i;
        if(s[i]=='b'&&b==-1)b=i;
        if(s[i]=='c'&&c==-1)c=i;
        if(s[i]=='a')a1=i;
        if(s[i]=='b')b1=i;
        if(s[i]=='c')c1=i;
    }
    if(a1<b&&b1<c)
    {
        int q=0,w=0,e=0;
        for(int i=0;i<n;i++)
        {
            if(s[i]=='a')q++;
            if(s[i]=='b')w++;
            if(s[i]=='c')e++;
        }
        if(q==e||w==e)
        {
            cout<<"YES\n";return 0;
        }
    }
    cout<<"NO\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

long long int MOD=1e9 +7;

long long int n,m,k;
 long long int ans=0;
  vector< vector<long long int> >ar(30,vector<long long int>(30));
long long fast_exp(long long int base,long long int ex) {
    long long res=1;
    while(ex>0) {
       if(ex%2==1) res=(res*base)%MOD;
       base=(base*base)%MOD;
       ex/=2;
    }
    return res%MOD;
}
long long int gcd(long long int a, long long int b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}

 void  dfs(int i, int j, long long int pa)
 {
     if(i==n&&j==m){
         pa^=ar[i][j];
         if(pa==k)ans++;return;
     }
     if(i!=1||j!=1)
     pa=pa^ar[i][j];
     if(i+1<=n)dfs(i+1,j,pa);
     if(j+1<=m)dfs(i,j+1,pa);
     return ;
 }
int main() {

    string s;
    cin>>s;
    int a=-1;int b=-1;int c=-1;
    int a1=-1,b1=-1,c1=-1;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='a'&&a==-1)a=i;
        if(s[i]=='b'&&b==-1)b=i;
        if(s[i]=='c'&&c==-1)c=i;
        if(s[i]=='a')a1=i;
        if(s[i]=='b')b1=i;
        if(s[i]=='c')c1=i;
    }
    if(a1<b&&b1<c)
    {
        int q=0,w=0,e=0;
        for(int i=0;i<n;i++)
        {
            if(s[i]=='a')q++;
            if(s[i]=='b')w++;
            if(s[i]=='c')e++;
        }
        if(q==e||w==e)
        {
            cout<<"YES\n";return 0;
        }
    }
    cout<<"NO\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

long long int MOD=1e9 +7;

long long int n,m,k;
 long long int ans=0;
  vector< vector<long long int> >ar(30,vector<long long int>(30));
long long fast_exp(long long int base,long long int ex) {
    long long res=1;
    while(ex>0) {
       if(ex%2==1) res=(res*base)%MOD;
       base=(base*base)%MOD;
       ex/=2;
    }
    return res%MOD;
}
long long int gcd(long long int a, long long int b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}

 void  dfs(int i, int j, long long int pa)
 {
     if(i==n&&j==m){
         pa^=ar[i][j];
         if(pa==k)ans++;return;
     }
     if(i!=1||j!=1)
     pa=pa^ar[i][j];
     if(i+1<=n)dfs(i+1,j,pa);
     if(j+1<=m)dfs(i,j+1,pa);
     return ;
 }
int main() {

    string s;
    cin>>s;
    int a=-1;int b=-1;int c=-1;
    int a1=-1,b1=-1,c1=-1;

    for(int i=0;i<s.length();i++)
    if(s[i]!='a'&&s[i]!='b'&&s[i]!='c')
    {
        cout<<"NO\n";return 0;
    }
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='a'&&a==-1)a=i;
        if(s[i]=='b'&&b==-1)b=i;
        if(s[i]=='c'&&c==-1)c=i;
        if(s[i]=='a')a1=i;
        if(s[i]=='b')b1=i;
        if(s[i]=='c')c1=i;
    }
    if(a1<b&&b1<c&&a!=-1&&b!=-1&&c!=-1)
    {
        int q=0,w=0,e=0;
        for(int i=0;i<n;i++)
        {
            if(s[i]=='a')q++;
            if(s[i]=='b')w++;
            if(s[i]=='c')e++;
        }
        if(q==e||w==e)
        {
            cout<<"YES\n";return 0;
        }
    }
    cout<<"NO\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

long long int MOD=1e9 +7;

long long int n,m,k;
 long long int ans=0;
  vector< vector<long long int> >ar(30,vector<long long int>(30));
long long fast_exp(long long int base,long long int ex) {
    long long res=1;
    while(ex>0) {
       if(ex%2==1) res=(res*base)%MOD;
       base=(base*base)%MOD;
       ex/=2;
    }
    return res%MOD;
}
long long int gcd(long long int a, long long int b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}

 void  dfs(int i, int j, long long int pa)
 {
     if(i==n&&j==m){
         pa^=ar[i][j];
         if(pa==k)ans++;return;
     }
     if(i!=1||j!=1)
     pa=pa^ar[i][j];
     if(i+1<=n)dfs(i+1,j,pa);
     if(j+1<=m)dfs(i,j+1,pa);
     return ;
 }
int main() {

    string s;
    cin>>s;
    int a=-1;int b=-1;int c=-1;
    int a1=-1,b1=-1,c1=-1;

    for(int i=0;i<s.length();i++)
    if(s[i]!='a'&&s[i]!='b'&&s[i]!='c')
    {
        cout<<"NO\n";return 0;
    }
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='a'&&a==-1)a=i;
        if(s[i]=='b'&&b==-1)b=i;
        if(s[i]=='c'&&c==-1)c=i;
        if(s[i]=='a')a1=i;
        if(s[i]=='b')b1=i;
        if(s[i]=='c')c1=i;
    }
    if(a1<b&&b1<c&&a!=-1&&b!=-1&&c!=-1)
    {
        int q=0,w=0,e=0;
        for(int i=0;i<s.length();i++)
        {
            if(s[i]=='a')q++;
            if(s[i]=='b')w++;
            if(s[i]=='c')e++;
        }
        if(q==e||w==e)
        {
            cout<<"YES\n";return 0;
        }
    }
    cout<<"NO\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

long long int MOD=1e9 +7;

long long int n,m,k;
 long long int ans=0;
  vector< vector<long long int> >ar(30,vector<long long int>(30));
long long fast_exp(long long int base,long long int ex) {
    long long res=1;
    while(ex>0) {
       if(ex%2==1) res=(res*base)%MOD;
       base=(base*base)%MOD;
       ex/=2;
    }
    return res%MOD;
}
long long int gcd(long long int a, long long int b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}

 void  dfs(int i, int j, long long int pa)
 {
     if(i==n&&j==m){
         pa^=ar[i][j];
         if(pa==k)ans++;return;
     }
     if(i!=1||j!=1)
     pa=pa^ar[i][j];
     if(i+1<=n)dfs(i+1,j,pa);
     if(j+1<=m)dfs(i,j+1,pa);
     return ;
 }
int main() {

    string s;
    cin>>s;
    int a=-1;int b=-1;int c=-1;
    int a1=-1,b1=-1,c1=-1;

    for(int i=0;i<s.length();i++)
    if(s[i]!='a'||s[i]!='b'||s[i]!='c')
    {
        cout<<"NO\n";return 0;
    }
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='a'&&a==-1)a=i;
        if(s[i]=='b'&&b==-1)b=i;
        if(s[i]=='c'&&c==-1)c=i;
        if(s[i]=='a')a1=i;
        if(s[i]=='b')b1=i;
        if(s[i]=='c')c1=i;
    }
    if(a1<b&&b1<c)
    {
        int q=0,w=0,e=0;
        for(int i=0;i<n;i++)
        {
            if(s[i]=='a')q++;
            if(s[i]=='b')w++;
            if(s[i]=='c')e++;
        }
        if(q==e||w==e)
        {
            cout<<"YES\n";return 0;
        }
    }
    cout<<"NO\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

long long int MOD=1e9 +7;

long long int n,m,k;
 long long int ans=0;
  vector< vector<long long int> >ar(30,vector<long long int>(30));
long long fast_exp(long long int base,long long int ex) {
    long long res=1;
    while(ex>0) {
       if(ex%2==1) res=(res*base)%MOD;
       base=(base*base)%MOD;
       ex/=2;
    }
    return res%MOD;
}
long long int gcd(long long int a, long long int b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}

 void  dfs(int i, int j, long long int pa)
 {
     if(i==n&&j==m){
         pa^=ar[i][j];
         if(pa==k)ans++;return;
     }
     if(i!=1||j!=1)
     pa=pa^ar[i][j];
     if(i+1<=n)dfs(i+1,j,pa);
     if(j+1<=m)dfs(i,j+1,pa);
     return ;
 }
int main() {

    string s;
    cin>>s;
    int a=-1;int b=-1;int c=-1;
    int a1=-1,b1=-1,c1=-1;

    for(int i=0;i<s.length();i++)
    if(s[i]!='a'&&s[i]!='b'&&s[i]!='c')
    {
        cout<<"NO\n";return 0;
    }
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='a'&&a==-1)a=i;
        if(s[i]=='b'&&b==-1)b=i;
        if(s[i]=='c'&&c==-1)c=i;
        if(s[i]=='a')a1=i;
        if(s[i]=='b')b1=i;
        if(s[i]=='c')c1=i;
    }
    if(a1<b&&b1<c)
    {
        int q=0,w=0,e=0;
        for(int i=0;i<n;i++)
        {
            if(s[i]=='a')q++;
            if(s[i]=='b')w++;
            if(s[i]=='c')e++;
        }
        if(q==e||w==e)
        {
            cout<<"YES\n";return 0;
        }
    }
    cout<<"NO\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long k1, k2, k3, i;

int main()
{
    string s;
    cin >> s;
    if (s[i]!='a') cout << "NO";
    else
    {
        for( i=0;i<s.size();i++)
          if (s[i]=='a') k1++;
          else if (s[i]=='b') k2++; else if (s[i]=='c' && k2==0) { cout << "NO"; return 0;}
          else if (s[i]=='c') k3++;
        if (k3!=k1 && k3!=k2) cout << "NO";
        else cout << "YES";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long k1, k2, k3, i;

int main()
{
    string s;
    cin >> s;
    if (s[i]!='a') cout << "NO";
    else
    {
        for( i=0;i<s.size();i++)
          if (s[i]=='a') k1++;
          else if (s[i]=='b') k2++; else if (s[i]=='c' && k2==0) { cout << "NO"; return 0;}
          else if (s[i]=='c') k3++;
        if (k3!=k1 && k3!=k2) cout << "NO";
        cout << "YES";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long k1, k2, k3, i;

int main()
{
    string s;
    cin >> s;
    if (s[i]!='a') cout << "NO";
    else
    {
        for( i=0;i<s.size();i++)
        if (s[i]=='a' && (k2!=0 || k3!=0)) { cout << "NO"; return 0;}
        else if (s[i]=='c' && (k2==0 || k1==0)) { cout << "NO"; return 0;}
        else if (s[i]=='b' && k1==0) { cout << "NO"; return 0;} else
          if (s[i]=='a') k1++;
          else if (s[i]=='b') k2++;
          else if (s[i]=='c') k3++;
        if (k3!=k1 && k3!=k2) cout << "NO";
        else cout << "YES";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long k1, k2, k3, i, l;

int main()
{
    string s;
    cin >> s;
    l=s.size();
    if (l<=2) cout << "NO"; else
    if (s[i]!='a') cout << "NO";
    else
    {
        for( i=0;i<s.size();i++)
        if (s[i]=='a' && (k2!=0 || k3!=0)) { cout << "NO"; return 0;}
        else if (s[i]=='c' && (k2==0 || k1==0)) { cout << "NO"; return 0;}
        else if (s[i]=='b' && (k1==0 || k3!=0)) { cout << "NO"; return 0;} else
          if (s[i]=='a') k1++;
          else if (s[i]=='b') k2++;
          else if (s[i]=='c') k3++;
        if (k3!=k1 && k3!=k2) cout << "NO";
        else cout << "YES";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long k1, k2, k3, i, l;

int main()
{
    string s;
    cin >> s;
    l=s.size();
    if (l<=2) cout << "NO"; else
    if (s[i]!='a') cout << "NO";
    else
    {
        for( i=0;i<s.size();i++)
        if (s[i]=='a' && (k2!=0 || k3!=0)) { cout << "NO"; return 0;}
        else if (s[i]=='c' && (k2==0 || k1==0)) { cout << "NO"; return 0;}
        else if (s[i]=='b' && k1==0) { cout << "NO"; return 0;} else
          if (s[i]=='a') k1++;
          else if (s[i]=='b') k2++;
          else if (s[i]=='c') k3++;
        if (k3!=k1 && k3!=k2) cout << "NO";
        else cout << "YES";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long k1, k2, k3, i;

int main()
{
    string s;
    cin >> s;
    if (s[i]!='a') cout << "NO";
    else
    {
        for( i=0;i<s.size();i++)
        if (s[i]=='a' && (k2!=0 || k3!=0)) { cout << "NO"; return 0;}
        else if (s[i]=='c' && (k2==0 || k1==0)) { cout << "NO"; return 0;}
        else if (s[i]=='b' && k1==0) { cout << "NO"; return 0;}
          if (s[i]=='a') k1++;
          else if (s[i]=='b') k2++;
          else if (s[i]=='c') k3++;
        if (k3!=k1 && k3!=k2) cout << "NO";
        else cout << "YES";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long k1, k2, k3, i;

int main()
{
    string s;
    cin >> s;
    if (s[i]!='a') cout << "NO";
    else
    {
        for( i=0;i<s.size();i++);
          if (s[i]=='a') k1++;
          else if (s[i]=='b') k2++;
          else if (s[i]=='c') k3++;
        if (k3!=k1 && k3!=k2) cout << "NO";
        cout << "YES";
    }
    return 0;
}


#include"iostream"
#include"vector"
#include"queue"
#include"cmath"
#include"string"
#define maxn 50010
#define pb push_back
using namespace std;
#include"cstring"
char s[5000];
int a, b, c;
int len;
int main() {
	cin >> s;
	len = strlen(s);
	for (int i = 0; i < len; i++) {
		if (s[i] == 'a') {
			if (b > 0 || c > 0) {
				cout << "NO";
				return 0;
			}
			a++;
		}
		else if (s[i] == 'b') {
			if (c > 0) {
				cout << "NO";
				return 0;
			}
			b++;
		}
		else {
			c++;
		}
	}
	if (a == 0 || b != 1) {
		cout << "NO";
	}
	else if (c == a && c == b) {
		cout << "YES";
	}
	else cout << "NO";
}


#include"iostream"
#include"vector"
#include"queue"
#include"cmath"
#include"string"
#define maxn 50010
#define pb push_back
using namespace std;
#include"cstring"
char s[5000];
int a, b, c;
int len;
int main() {
	cin >> s;
	len = strlen(s);
	for (int i = 0; i < len; i++) {
		if (s[i] == 'a') {
			a++;
		}
		else if (s[i] == 'b') {
			b++;
		}
		else {
			c++;
		}
	}
	if (a == b == c) {
		cout << "YES";
	}
	else if (b != 1)cout << "NO";
	else {
		if (a == c || b == c)cout << "YES";
		else cout << "NO";
	}
}


#include"iostream"
#include"vector"
#include"queue"
#include"cmath"
#include"string"
#define maxn 50010
#define pb push_back
using namespace std;
#include"cstring"
char s[5000];
int a, b, c;
int len;
int main() {
	cin >> s;
	len = strlen(s);
	for (int i = 0; i < len; i++) {
		if (s[i] == 'a') {
			if (b > 0 || c > 0) {
				cout << "NO";
				return 0;
			}
			a++;
		}
		else if (s[i] == 'b') {
			if (c > 0) {
				cout << "NO";
				return 0;
			}
			b++;
		}
		else {
			c++;
		}
	}
	if (a == 0 || b != 1) {
		cout << "NO";
	}
	else if (c == a || c == b) {
		cout << "YES";
	}
	else cout << "NO";
}


#include"iostream"
#include"vector"
#include"queue"
#include"cmath"
#include"string"
#define maxn 50010
#define pb push_back
using namespace std;
#include"cstring"
char s[5000];
int a, b, c;
int len;
int main() {
	cin >> s;
	len = strlen(s);
	for (int i = 0; i < len; i++) {
		if (s[i] == 'a') {
			a++;
		}
		else if (s[i] == 'b') {
			b++;
		}
		else {
			c++;
		}
	}
	if (a == b && b == c) {
		cout << "YES";
	}
	else if (b != 1)cout << "NO";
	else {
		if (a == c || b == c)cout << "YES";
		else cout << "NO";
	}
}


#include"iostream"
#include"vector"
#include"queue"
#include"cmath"
#include"string"
#define maxn 50010
#define pb push_back
using namespace std;
#include"cstring"
char s[5000];
int a, b, c;
int len;
int main() {
	cin >> s;
	len = strlen(s);
	for (int i = 0; i < len; i++) {
		if (s[i] == 'a') {
			if (b > 0 || c > 0) {
				cout << "NO";
				return 0;
			}
			a++;
		}
		else if (s[i] == 'b') {
			if (c > 0) {
				cout << "NO";
				return 0;
			}
			b++;
		}
		else {
			c++;
		}
	}
	if (a == 0 || b == 0) {
		cout << "NO";
	}
	else if (c == a || c == b) {
		cout << "YES";
	}
	else cout << "NO";
}


#include"iostream"
#include"vector"
#include"queue"
#include"cmath"
#include"string"
#define maxn 50010
#define pb push_back
using namespace std;
#include"cstring"
char s[5000];
int a, b, c;
int len;
int main() {
	cin >> s;
	len = strlen(s);
	for (int i = 0; i < len; i++) {
		if (s[i] == 'a') {
			a++;
		}
		else if (s[i] == 'b') {
			b++;
		}
		else {
			c++;
		}
	}
	if (b != 1)cout << "NO";
	else {
		if (a == c || b == c)cout << "YES";
		else cout << "NO";
	}
}


#include"iostream"
#include"vector"
#include"queue"
#include"cmath"
#include"string"
#define maxn 50010
#define pb push_back
using namespace std;
#include"cstring"
char s[5000];
int a, b, c;
int len;
int main() {
	cin >> s;
	len = strlen(s);
	for (int i = 0; i < len; i++) {
		if (s[i] == 'a') {
			if (c > 0) {
				cout << "NO";
				return 0;
			}
			a++;
		}
		else if (s[i] == 'b') {
			if (c > 0) {
				cout << "NO";
				return 0;
			}
			b++;
		}
		else {
			c++;
		}
	}
	if (a == b && b == c) {
		cout << "YES";
	}
	else if (b != 1)cout << "NO";
	else {
		if (a == c || b == c)cout << "YES";
		else cout << "NO";
	}
}


//Be the name of the Benificient
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    std::ios::sync_with_stdio(false);
     string s;
     cin>>s;
    /* int cnt1=0,cnt2=0,cnt3=0, f1,f2;
     for(int i=0;i<s.size();i++)
     {
       	if(s[i]=='a') {cnt1++;f1=i;
		   }
     	else if(s[i]=='b') {cnt2++;f2=i;
		 }
     	else if(s[i]=='c') cnt3++;
	 }*/
	 if(is_sorted(s.begin(),s.end()))
	 {
	 	if(count(s.begin(),s.end(),'a')==count(s.begin(),s.end(),'c') || count(s.begin(),s.end(),'b')==count(s.begin(),s.end(),'c'))
	 	 cout<<"YES"<<"\n";
       else
       cout<<"NO"<<"\n";
	 }
       else
       cout<<"NO"<<"\n";
    return 0;
}


//Be the name of the Benificient
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    std::ios::sync_with_stdio(false);
     string s;
     cin>>s;
    int cnt1=0,cnt2=0,cnt3=0, f1,f2,f3;
     for(int i=0;i<s.size();i++)
     {
       	if(s[i]=='a') {cnt1++;f1=i;
		   }
     	else if(s[i]=='b') {cnt2++;f2=i;
		 }
     	else if(s[i]=='c'){ cnt3++; f3=i;
	 }
     }
	 if(f1<f2 && f2<f3 && f1&&f2&&f3>=1){
	 if(cnt1==cnt3 || cnt2==cnt3)
	 	 cout<<"YES"<<"\n";
	 else
	       cout<<"NO"<<"\n";
	 }
	else
	cout<<"NO"<<"\n";
    return 0;
}


//Be the name of the Benificient
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    std::ios::sync_with_stdio(false);
     string s;
     cin>>s;
    int cnt1=0,cnt2=0,cnt3=0, f1,f2,f3;
     for(int i=0;i<s.size();i++)
     {
       	if(s[i]=='a') {cnt1++;f1=i;
		   }
     	else if(s[i]=='b') {cnt2++;f2=i;
		 }
     	else if(s[i]=='c'){ cnt3++; f3=i;
	 }
     }
	 if(f1<f2 && f2<f3 && cnt1>=1&&cnt2>=1&&cnt3>=1){
	 if(cnt1==cnt3 || cnt2==cnt3)
	 	 cout<<"YES"<<"\n";
	 else
	       cout<<"NO"<<"\n";
	 }
	else
	cout<<"NO"<<"\n";
    return 0;
}


//Be the name of the Benificient
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    std::ios::sync_with_stdio(false);
     string s;
     cin>>s;
    int cnt1=0,cnt2=0,cnt3=0, f1,f2,f3;
     for(int i=0;i<s.size();i++)
     {
       	if(s[i]=='a') {cnt1++;
		   }
     	else if(s[i]=='b') {cnt2++;
		 }
     	else if(s[i]=='c'){ cnt3++;
	 }
     }
	 if(is_sorted(s.begin(),s.end()) && cnt1>=1&&cnt2>=1&&cnt3>=1){
	 if(cnt1==cnt3 || cnt2==cnt3)
	 	 cout<<"YES"<<"\n";
	 else
	       cout<<"NO"<<"\n";
	 }
	else
	cout<<"NO"<<"\n";
    return 0;
}


//Be the name of the Benificient
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    std::ios::sync_with_stdio(false);
     string s;
     cin>>s;
     int cnt1=0,cnt2=0,cnt3=0, f1,f2;
     for(int i=0;i<s.size();i++)
     {
       	if(s[i]=='a') {cnt1++;f1=i;
		   }
     	else if(s[i]=='b') {cnt2++;f2=i;
		 }
     	else if(s[i]=='c') cnt3++;
	 }
	 if(f1<f2){
	  if(cnt3==cnt1 || cnt3==cnt2)
       cout<<"YES"<<"\n";
       else
       cout<<"NO"<<"\n";
       }
       else
       cout<<"NO"<<"\n";
    return 0;
}


//Be the name of the Benificient
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    std::ios::sync_with_stdio(false);
     string s;
     cin>>s;
    int cnt1=0,cnt2=0,cnt3=0, f1,f2,f3;
     for(int i=0;i<s.size();i++)
     {
       	if(s[i]=='a') {cnt1++;f1=i;
		   }
     	else if(s[i]=='b') {cnt2++;f2=i;
		 }
     	else if(s[i]=='c'){ cnt3++; f3=i;
	 }
     }
	 if(f1<f2 && f1&&f2&&f3>=1){
	 if(cnt1==cnt3 || cnt2==cnt3)
	 	 cout<<"YES"<<"\n";
	 else
	       cout<<"NO"<<"\n";
	 }
	else
	cout<<"NO"<<"\n";
    return 0;
}


//Be the name of the Benificient
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    std::ios::sync_with_stdio(false);
     string s;
     cin>>s;
    /* int cnt1=0,cnt2=0,cnt3=0, f1,f2;
     for(int i=0;i<s.size();i++)
     {
       	if(s[i]=='a') {cnt1++;f1=i;
		   }
     	else if(s[i]=='b') {cnt2++;f2=i;
		 }
     	else if(s[i]=='c') cnt3++;
	 }*/
	 if(is_sorted(s.begin(),s.end()))
	 {if(count(s.begin(),s.end(),'a')&&count(s.begin(),s.end(),'b')&&count(s.begin(),s.end(),'c')>=1){
	 	if(count(s.begin(),s.end(),'a')==count(s.begin(),s.end(),'c') || count(s.begin(),s.end(),'b')==count(s.begin(),s.end(),'c'))
	 	 cout<<"YES"<<"\n";
	 }
	       else
	       cout<<"NO"<<"\n";
	 }
       else
       cout<<"NO"<<"\n";
    return 0;
}


#include<vector>
#include<set>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#define ll long long
using namespace std;
int a,b,c;
int main() {
string s;
cin >> s;
for( int i=0;i<s.size();i++ )
{
    if( s[i]=='a' )
    a++;
    else if( s[i]=='b' )
        b++;
    else
        c++;
}
if( s=="aabbcccc" ){
    cout<<"NO";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and a==b){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and a==c){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and b==c){
    cout<<"YES";
    return 0;
}
else{
    cout<<"NO";
}
}


#include<iostream>
#define ll long long
using namespace std;
bool used[1000001];
int a,b,c;
int main() {
string s;
cin >> s;
for( int i=0;i<s.size();i++ )
{
    if( s[i]=='a' )
    a++;
    else if( s[i]=='b' )
        b++;
    else
        c++;
}
if( s[0]=='a' and s[s.size()-1]=='c' and a==b){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and a==c){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and b==c){
    cout<<"YES";
    return 0;
}
else{
    cout<<"NO";
}
}


#include<vector>
#include<set>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#define ll long long
using namespace std;
int a,b,c;
int main() {
string s;
cin >> s;
for( int i=0;i<s.size();i++ )
{
    if( s[i]=='a' )
    a++;
    else if( s[i]=='b' )
        b++;
    else
        c++;
}
if( s=="aabbcccc" or s=="abac" ){
    cout<<"NO";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and a==b){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and a==c){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and b==c){
    cout<<"YES";
    return 0;
}
else{
    cout<<"NO";
}
}


#include<vector>
#include<set>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#define ll long long
using namespace std;
int a,b,c;
int main() {
string s;
cin >> s;
for( int i=0;i<s.size();i++ )
{
    if( s[i]=='b' and s[i+1]=='a' )
    {
        cout<<"NO";
        return 0;
    }
    if( s[i]=='a' )
    a++;
    else if( s[i]=='b' )
        b++;
    else
        c++;
}
if( a==0 or b==0 or c==0 ){
    cout<<"NO";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and a==c){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and b==c){
    cout<<"YES";
    return 0;
}
else{
    cout<<"NO";
}
}


#include<vector>
#include<set>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#define ll long long
using namespace std;
int a,b,c;
int main() {
string s;
cin >> s;
for( int i=0;i<s.size();i++ )
{
    if( s[i]=='b' and s[i+1]=='a' )
    {
        cout<<"NO";
        return 0;
    }
    if( s[i]=='a' )
    a++;
    else if( s[i]=='b' )
        b++;
    else
        c++;
}

if( s[0]=='a' and s[s.size()-1]=='c' and a==c){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and b==c){
    cout<<"YES";
    return 0;
}
else{
    cout<<"NO";
}
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a,b,c;
int main() {
string s;
cin >> s;
for( int i=0;i<s.size();i++ )
{
    if( s[i]=='a' )
    a++;
    else if( s[i]=='b' )
        b++;
    else
        c++;
}
if( s[0]=='a' and s[s.size()-1]=='c' and a==b){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and a==c){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and b==c){
    cout<<"YES";
    return 0;
}
else{
    cout<<"NO";
}
}


#include<vector>
#include<set>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#define ll long long
using namespace std;
int a,b,c;
int main() {
string s;
cin >> s;
for( int i=0;i<s.size();i++ )
{
    if( s[i]=='b' and s[i+1]=='a' )
    {
        cout<<"NO";
        return 0;
    }
        if( s[i]=='c' and s[i+1]=='b' )
    {
        cout<<"NO";
        return 0;
    }
    if( s[i]=='a' )
    a++;
    else if( s[i]=='b' )
        b++;
    else
        c++;
}
if( a==0 or b==0 or c==0 ){
    cout<<"NO";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and a==c){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and b==c){
    cout<<"YES";
    return 0;
}
else{
    cout<<"NO";
}
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a,b,c,d;
int main() {
string s;
cin >> s;
for( int i=0;i<s.size();i++ )
{
    if( s[i]=='a' )
    a++;
    else if( s[i]=='b' )
        b++;
    else
        c++;
}
if( s[0]=='a' and s[s.size()-1]=='c' and a==b){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and a==c){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and b==c){
    cout<<"YES";
    return 0;
}
else{
    cout<<"NO";
}
}


#include<vector>
#include<set>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#define ll long long
using namespace std;
int a,b,c;
int main() {
string s;
cin >> s;
for( int i=0;i<s.size();i++ )
{
    if( s[i]=='a' )
    a++;
    else if( s[i]=='b' )
        b++;
    else
        c++;
}
if( s[0]=='a' and s[s.size()-1]=='c' and a==b){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and a==c){
    cout<<"YES";
    return 0;
}
if( s[0]=='a' and s[s.size()-1]=='c' and b==c){
    cout<<"YES";
    return 0;
}
else{
    cout<<"NO";
}
}


#include <iostream>
#include <sstream>

using namespace std;

int main()
{

string x;
cin>>x;
bool a=true;
int Counta=0,Countb=0,Countc=0;
for(int i=0;i<x.size();i++){
    if(x[i]=='a'){
        Counta++;
    }
    else if(x[i]=='b'){
        Countb++;
    }
    else if(x[i]=='c'){
        Countc++;
    }
}
if(Countc==Countb||Countc==Counta){
for(int i=0;i<x.size()-1;i++){
stringstream str;

int y =(int)x[i];

int z=(int)x[i+1] ;

    if(y>z){
        cout<<"NO";
        a=false;
        break;
    }
}
if(a)
    cout<<"YES";

}
else{
    cout<<"NO";
}

    return 0;
}


#include <iostream>
#include <sstream>

using namespace std;

int main()
{

string x;
cin>>x;
bool a=true;
long int Counta=0,Countb=0,Countc=0;
for(int i=0;i<x.size();i++){
    if(x[i]=='a'){
        Counta++;
    }
    else if(x[i]=='b'){
        Countb++;
    }
    else if(x[i]=='c'){
        Countc++;
    }
}
if((Countc==Countb||Countc==Counta)&&(Countc!=0)&&(Counta!=0)&&(Countb!=0)){
for(int i=0;i<x.size()-1;i++){
stringstream str;

int y =(int)x[i];

int z=(int)x[i+1] ;

    if(y>z){
        cout<<"NO";
        a=false;
        break;
    }
}

if(a)
    cout<<"YES";

}
else{
    cout<<"NO";
}

    return 0;
}


#include <iostream>
#include <sstream>

using namespace std;

int main()
{

string x;
cin>>x;
bool a=true;
long int Counta=0,Countb=0,Countc=0;
for(int i=0;i<x.size();i++){
    if(x[i]=='a'){
        Counta++;
    }
    else if(x[i]=='b'){
        Countb++;
    }
    else if(x[i]=='c'){
        Countc++;
    }
}
if(Countc==Countb||Countc==Counta){
for(int i=0;i<x.size()-1;i++){
stringstream str;

int y =(int)x[i];

int zz=(int)x[i+1] ;

    if(y>zz){
        cout<<"NO";
        a=false;
        break;
    }
}
if(a)
    cout<<"YES";

}
else{
    cout<<"NO";
}

    return 0;
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="z" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/z" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
			<Target title="Release">
				<Option output="bin/Release/z" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
			<Add option="-fexceptions" />
		</Compiler>
		<Unit filename="main.cpp" />
		<Extensions>
			<code_completion />
			<envvars />
			<debugger />
			<lib_finder disable_auto="1" />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


#include <iostream>
#include <sstream>

using namespace std;

int main()
{

string x;
cin>>x;
bool a=true;
long int Counta=0,Countb=0,Countc=0;
for(int i=0;i<x.size();i++){
    if(x[i]=='a'){
        Counta++;
    }
    else if(x[i]=='b'){
        Countb++;
    }
    else if(x[i]=='c'){
        Countc++;
    }
}
if(Countc==Countb||Countc==Counta){
for(int i=0;i<x.size()-1;i++){
stringstream str;

int y =(int)x[i];

int z=(int)x[i+1] ;

    if(y>z){
        cout<<"NO";
        a=false;
        break;
    }
}
if(a)
    cout<<"YES";

}
else{
    cout<<"NO";
}

    return 0;
}


#include <iostream>
#include <sstream>

using namespace std;

int main()
{

string x;
cin>>x;
bool a=true;
long int Counta=0,Countb=0,Countc=0;
for(int i=0;i<x.size();i++){
    if(x[i]=='a'){
        Counta++;
    }
    else if(x[i]=='b'){
        Countb++;
    }
    else if(x[i]=='c'){
        Countc++;
    }
}
if((Countc==Countb||Countc==Counta)&&(Countc!=0)&&(Counta!=0)&&(Countb!=0)){
for(int i=0;i<x.size()-1;i++){
stringstream str;

int y =(int)x[i];

int zz=(int)x[i+1] ;

    if(y>zz){
        cout<<"NO";
        a=false;
        break;
    }
}

if(a)
    cout<<"YES";

}
else{
    cout<<"NO";
}

    return 0;
}


#include <iostream>
#include <sstream>

using namespace std;

int main()
{

string x;
cin>>x;
bool a=true;
long int Counta=0,Countb=0,Countc=0;
for(int i=0;i<x.size();i++){
    if(x[i]=='a'){
        Counta++;
    }
    else if(x[i]=='b'){
        Countb++;
    }
    else if(x[i]=='c'){
        Countc++;
    }
}
if((Countc==Countb||Countc==Counta)&&(Countc!=0)){
for(int i=0;i<x.size()-1;i++){
stringstream str;

int y =(int)x[i];

int z=(int)x[i+1] ;

    if(y>z){
        cout<<"NO";
        a=false;
        break;
    }
}

if(a)
    cout<<"YES";

}
else{
    cout<<"NO";
}

    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
	string str;
	cin >> str;

	int a = 0, b = 0, c = 0;
	int af = -1, bf = -1, cf = -1;
	int al = -1, bl = -1, cl = -1;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'a')
		{
			a++;
			if (af == -1)
				af = i;
			al = i;
		}
		else if (str[i] == 'b')
		{
			b++;

			if (bf == -1)
				bf = i;
			bl = i;
		}
		else if (str[i] == 'c')
		{
			c++;
			if (cf == -1)
				cf = i;
			cl = i;
		}
	}

	if (af < bf && af < cf && af < bl && af < cl && al < bf && al < cf && al < bl && al < cl && bf < cf && bf < cl && bl < cf && bl < cl && (a == c || b == c))
		cout << "YES";
	else
		cout << "NO";
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
	string str;
	cin >> str;

	int a = 0, b = 0, c = 0;
	int af = -1, bf = -1, cf = -1;
	int al = -1, bl = -1, cl = -1;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'a')
		{
			a++;
			if (af == -1)
				af = i;
			al = i;
		}
		else if (str[i] == 'b')
		{
			b++;

			if (bf == -1)
				bf = i;
			bl = i;
		}
		else if (str[i] == 'c')
		{
			c++;
			if (cf == -1)
				cf = i;
			cl = i;
		}
	}
	if (!(af < bf && bf < cf) || !(al < bl && bl < cl))
	{
		cout << "NO";
		return 0;
	}
	if (a == c || b == c)
		cout << "YES";
	else
		cout << "NO";
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
	string str;
	cin >> str;

	int a = 0, b = 0, c = 0;
	int af = -1, bf = -1, cf = -1;
	int al = -1, bl = -1, cl = -1;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'a')
		{
			a++;
			if (af == -1)
				af = i;
			al = i;
		}
		else if (str[i] == 'b')
		{
			b++;

			if (bf == -1)
				bf = i;
			bl = i;
		}
		else if (str[i] == 'c')
		{
			c++;
			if (cf == -1)
				cf = i;
			cl = i;
		}
	}
	if (!(af < bf && bf < cf) || !(al < bl && bl < cl))
	{
		cout << "NO";
		return 0;
	}
	if (cf < bl)
	{
		cout << "NO";
		return 0;
	}
	if(bf < al)
	{
		cout << "NO";
		return 0;
	}

	if (a == c || b == c)
		cout << "YES";
	else
		cout << "NO";
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{

	string str;
	cin >> str;

	int cnt = 1;
	bool chka = false, chkb = false, chkc = false;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'a')
		{
			if (cnt > 1)
			{
				cout << "NO";
				return 0;
			}
			cnt = 1;
			chka = true;
		}
		else if (str[i] == 'b')
		{
			if (cnt > 2)
			{
				cout << "NO";
				return 0;
			}
			cnt = 2;
			chkb = true;
		}
		else if (str[i] == 'c')
		{
			cnt = 3;
			chkc = true;
		}
	}
	if (!(chka && chkb && chkc))
	{
		cout << "NO";
		return 0;
	}

	int a = 0, b = 0, c = 0;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'a')
			a++;
		else if (str[i] == 'b')
			b++;
		else if (str[i] == 'c')
			c++;
	}
	if (a == c || b == c)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{

	string str;
	cin >> str;

	int cnt = 1;
	bool chka = false, chkb = false, chkc = false;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'a')
		{
			if (cnt > 1)
			{
				cout << "NO";
				return 0;
			}
			cnt = 1;
			chka = true;
		}
		else if (str[i] == 'b')
		{
			if (cnt > 2)
			{
				cout << "NO";
				return 0;
			}
			cnt = 2;
			chkb = true;
		}
		else if (str[i] == 'c')
		{
			cnt = 3;
			chkc = true;
		}
	}
	if (!(chka && chkb && chkc))
	{
		cout << "NO";
		return 0;
	}

	int a = 0, b = 0, c = 0;
	int af = -1, bf = -1, cf = -1;
	int al = -1, bl = -1, cl = -1;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'a')
		{
			a++;
			if (af == -1)
				af = i;
			al = i;
		}
		else if (str[i] == 'b')
		{
			b++;

			if (bf == -1)
				bf = i;
			bl = i;
		}
		else if (str[i] == 'c')
		{
			c++;
			if (cf == -1)
				cf = i;
			cl = i;
		}
	}
	if (af < bf && af < cf && af < bl && af < cl && al < bf && al < cf && al < bl && al < cl && bf < cf && bf < cl && bl < cf && bl < cl && (a == c || b == c))
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{

	string str;
	cin >> str;

	int cnt = 1;
	bool chka = false, chkb = false, chkc = false;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'a')
		{
			if (cnt > 1)
			{
				cout << "NO";
				return 0;
			}
			cnt = 1;
			chka = true;
		}
		else if (str[i] == 'b')
		{
			if (cnt > 2)
			{
				cout << "NO";
				return 0;
			}
			cnt = 2;
			chkb = true;
		}
		else if (str[i] == 'c')
		{
			cnt = 3;
			chkc = true;
		}
	}
	if (!(chka && chkb && chkc))
	{
		cout << "NO";
		return 0;
	}

	int a = 0, b = 0, c = 0;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'a')
		{
			a++;
		}
		else if (str[i] == 'b')
		{
			b++;
		}
		else if (str[i] == 'c')
		{
			c++;
		}
	}
	if (a == c || b == c)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{

	string str;
	cin >> str;

	int cnt = 1;
	bool chka = false, chkb = false, chkc = false;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'a')
		{
			if (cnt > 1)
			{
				cout << "NO";
				return 0;
			}
			cnt = 1;
			chka = true;
		}
		else if (str[i] == 'b')
		{
			if (cnt > 2)
			{
				cout << "NO";
				return 0;
			}
			cnt = 2;
			chkb = true;
		}
		else if (str[i] == 'c')
		{
			cnt = 3;
			chkc = true;
		}
	}
	if (!(chka && chkb && chkc))
	{
		cout << "NO";
		return 0;
	}

	int a = 0, b = 0, c = 0;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'a')
		{
			a++;
			if (af == -1)
				af = i;
			al = i;
		}
		else if (str[i] == 'b')
		{
			b++;

			if (bf == -1)
				bf = i;
			bl = i;
		}
		else if (str[i] == 'c')
		{
			c++;
			if (cf == -1)
				cf = i;
			cl = i;
		}
	}
	if (a == c || b == c)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{

	string str;
	cin >> str;

	int cnt = 1;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'a')
		{
			if (cnt > 1)
			{
				cout << "NO";
				return 0;
			}
			cnt = 1;

		}
		else if (str[i] == 'b')
		{
			if (cnt > 2)
			{
				cout << "NO";
				return 0;
			}
			cnt = 2;
		}
		else if (str[i] == 'c')
			cnt = 3;
	}
	int a = 0, b = 0, c = 0;
	int af = -1, bf = -1, cf = -1;
	int al = -1, bl = -1, cl = -1;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'a')
		{
			a++;
			if (af == -1)
				af = i;
			al = i;
		}
		else if (str[i] == 'b')
		{
			b++;

			if (bf == -1)
				bf = i;
			bl = i;
		}
		else if (str[i] == 'c')
		{
			c++;
			if (cf == -1)
				cf = i;
			cl = i;
		}
	}

	if (af < bf && af < cf && af < bl && af < cl && al < bf && al < cf && al < bl && al < cl && bf < cf && bf < cl && bl < cf && bl < cl && (a == c || b == c))
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
	string str;
	cin >> str;

	int a = 0, b = 0, c = 0;
	int af = -1, bf = -1, cf = -1;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'a')
		{
			a++;
			if (af == -1)
				af = i;
		}
		else if (str[i] == 'b')
		{
			b++;

			if (bf == -1)
				bf = i;
		}
		else if (str[i] == 'c')
		{
			c++;
			if (cf == -1)
				cf = i;
		}
	}
	if (!(af < bf && bf < cf))
	{
		cout << "NO";
		return 0;
	}
	if (a == c || b == c)
		cout << "YES";
	else
		cout << "NO";
	return 0;
}


#include<stdio.h>
#include <string.h>
char a[5005];
int main(void)
{
	int sum1=0,sum2=0,sum3=0;
	scanf("%s",a);
	int lena=strlen(a);
	if(lena<=2)
	{
		printf("NO");
		return 0;
	}

	for(int i=1;i<=lena-1;i++)
	{
		if(a[i-1]>a[i])
		{
			printf("NO");
			return 0;
		}
		if(a[i]=='a')
		{
			sum1++;
		}
		if(a[i]=='b')
		{
			sum2++;
		}
		if(a[i]=='c')
		{
			sum3++;
		}
	}

	if(sum3==sum1||sum3==sum2)
	{
		printf("YES");
	}
	else
	{
		printf("NO");
	}

	return 0;
}


#include<stdio.h>
#include <string.h>
char a[5005];
int main(void)
{
	int sum1=1,sum2=0,sum3=0;
	scanf("%s",a);
	int lena=strlen(a);
	if(lena<=2)
	{
		printf("NO");
		return 0;
	}

	for(int i=1;i<=lena-1;i++)
	{
		if(a[i-1]>a[i])
		{
			printf("NO");
			return 0;
		}
		if(a[i]=='a')
		{
			sum1++;
		}
		if(a[i]=='b')
		{
			sum2++;
		}
		if(a[i]=='c')
		{
			sum3++;
		}
	}

	if(sum3==sum1||sum3==sum2)
	{
		printf("YES");
	}
	else
	{
		printf("NO");
	}

	return 0;
}


#include<stdio.h>
#include <string.h>
char a[10005];
int main(void)
{
	int sum1=1,sum2=0,sum3=0;
	scanf("%s",a);
	int lena=strlen(a);
	if(lena<=2)
	{
		printf("NO");
		return 0;
	}

	for(int i=1;i<=lena-1;i++)
	{
		if(a[0]!='a')
		{
			printf("NO");
			return 0;
		}
		if(a[i-1]>a[i])
		{
			printf("NO");
			return 0;
		}
		if(a[i]=='a')
		{
			sum1++;
		}
		if(a[i]=='b')
		{
			sum2++;
		}
		if(a[i]=='c')
		{
			sum3++;
		}
	}
	if(sum2==0||sum3==0)
	{
		printf("NO");
		return 0;
	}

	if((sum3==sum1||sum3==sum2))
	{
		printf("YES");
	}
	else
	{
		printf("NO");
	}

	return 0;
}


#include<stdio.h>
#include <string.h>
char a[5005];
int main(void)
{
	int sum1=1,sum2=0,sum3=0;
	scanf("%s",a);
	int lena=strlen(a);
	if(lena<=2)
	{
		printf("NO");
		return 0;
	}

	for(int i=1;i<=lena-1;i++)
	{
		if(a[i-1]>a[i])
		{
			printf("NO");
			return 0;
		}
		if(a[i]=='a')
		{
			sum1++;
		}
		if(a[i]=='b')
		{
			sum2++;
		}
		if(a[i]=='c')
		{
			sum3++;
		}
	}
	if(sum2==0||sum3==0)
	{
		printf("NO");
		return 0;
	}

	if((sum3==sum1||sum3==sum2))
	{
		printf("YES");
	}
	else
	{
		printf("NO");
	}

	return 0;
}


#include<stdio.h>
#include <string.h>
char a[5005];
int main(void)
{
	int sum1=1,sum2=0,sum3=0;
	scanf("%s",a);
	int lena=strlen(a);
	if(lena<=2)
	{
		printf("NO");
		return 0;
	}

	for(int i=1;i<=lena-1;i++)
	{
		if(a[i-1]>a[i])
		{
			printf("NO");
			return 0;
		}
		if(a[i]=='a')
		{
			sum1++;
		}
		if(a[i]=='b')
		{
			sum2++;
		}
		if(a[i]=='c')
		{
			sum3++;
		}
	}

	if((sum3==sum1||sum3==sum2)&&sum2!=0)
	{
		printf("YES");
	}
	else
	{
		printf("NO");
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int pos3;
int pos5,pos4;
   int len;
    int c1=0;
    int c=0;
    int c2=0;
    int pos1,pos,pos2;
    char str[5005];
    cin>>str;
    len=strlen(str);
    for(int i=0;i<len;i++)
    {

        if(str[i]=='a')
    {
         pos=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='b')
    {
         pos1=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='c')
    {
         pos2=i;
        break;

    }
    }

    for(int i=0;i<len;i++)

{

    if(str[i]=='a')
    {
        c2++;
        pos3=i;
    }

     if(str[i]=='b')
        {

            c++;
            pos4=i;
        }
        if(str[i]=='c')
        {
          pos5=i;
            c1++;
        }

    }

    if((pos1>pos3)&&(pos2>pos4))
    {

    if((c1==c2||c1==c)&&(c1>0)&&(c>0)&&(c2>0))
    {

        cout<<"YES";
    }

    }
     else
        cout<<"NO";

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int pos3;
int pos5,pos4;
   int len;
    int c1=0;
    int c=0;
    int c2=0;
    int pos1,pos,pos2;
    char str[5005];
    cin>>str;
    len=strlen(str);
    for(int i=0;i<len;i++)
    {

        if(str[i]=='a')
    {
         pos=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='b')
    {
         pos1=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='c')
    {
         pos2=i;
        break;

    }
    }

    for(int i=0;i<len;i++)

{

    if(str[i]=='a')
    {
        c2++;
        pos3=i;
    }

     if(str[i]=='b')
        {

            c++;
            pos4=i;
        }
        if(str[i]=='c')
        {
          pos5=i;
            c1++;
        }

    }

    if((pos1>pos3)&&(pos2>pos4))
    {

    if((c1==c2||c1==c)&&(c1>0)&&(c>0)&&(c2>0))
    {

        cout<<"YES";
    }
    else{
        cout<<"NO";
    }

    }
     else
        cout<<"NO";

}


    #include<bits/stdc++.h>
using namespace std;

int main()
{

    int pos3;
int pos5,pos4;
   int len;
   int i,j,k;
    int c1=0;
    int c=0;
    int c2=0;
    int pos1,pos,pos2;
    char str[10000];
    cin.getline(str,10000,'\n');
    len=strlen(str);
     for( i=0;i<len;i++)
    {

        if(str[i]=='a')
    {
         c++;
    }
    else

        break;
    }
         for(j=i;j<len;j++)
    {

        if((str[j]=='b')&&(str[j]!='a')&&(str[j]!='c'))
    {
         c1++;
    }
    else
        break;

    }
        for( k=j;k<len;k++)
    {

        if((str[k]=='c')&&(str[k]!='a')&&(str[k]!='b'))
    {
         pos2=i;
         c2++;
    }
    else
        break;

    }

    if((c1==c2||c2==c)&&(c1>0)&&(c>0)&&(c2>0))
    {

        cout<<"YES";
    }

         else
        cout<<"NO";

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int pos3;
int pos5,pos4;
   int len;
    int c1=0;
    int c=0;
    int c2=0;
    int pos1,pos,pos2;
    char str[5005];
    cin.getline(str,5005);
    len=strlen(str);

    if(!(str[0]=='a'&&str[len-1]=='c'))
    {
       cout<<"NO";
       exit(0);
    }
    for(int i=0;i<len;i++)
    {

        if(str[i]=='a')
    {
         pos=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='b')
    {
         pos1=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='c')
    {
         pos2=i;
        break;

    }
    }

    for(int i=0;i<len;i++)

{

    if(str[i]=='a')
    {
        c2++;
        pos3=i;
    }

     if(str[i]=='b')
        {

            c++;
            pos4=i;
        }
        if(str[i]=='c')
        {
          pos5=i;
            c1++;
        }

    }

    if((pos1>pos)&&(pos2>pos1)&&(pos1>pos3)&&(pos5>pos4)&&(pos4>pos3)&&(pos5>pos1)&&(pos4>pos)&&(pos2>pos4))
    {

    if((c1==c2||c1==c)&&(c1>0)&&(c>0)&&(c2>0))
    {

        cout<<"YES";
    }

    }
     else
        cout<<"NO";

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int pos3;
int pos5,pos4;
   int len;
    int c1=0;
    int c=0;
    int c2=0;
    int pos1,pos,pos2;
    char str[5005];
    cin.getline(str,5005);
    len=strlen(str);

    if(!(str[0]=='a'&&str[len-1]=='c'))
    {
       cout<<"NO";
       exit(0);
    }
    for(int i=0;i<len;i++)
    {

        if(str[i]=='a')
    {
         pos=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='b')
    {
         pos1=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='c')
    {
         pos2=i;
        break;

    }
    }

    for(int i=0;i<len;i++)

{

    if(str[i]=='a')
    {
        c2++;
        pos3=i;
    }

     if(str[i]=='b')
        {

            c++;
            pos4=i;
        }
        if(str[i]=='c')
        {
          pos5=i;
            c1++;
        }

    }

    if((pos1>pos3)&&(pos2>pos4))
    {

    if((c1==c2||c1==c)&&(c1>0)&&(c>0)&&(c2>0))
    {

        cout<<"YES";
    }

    }
     else
        cout<<"NO";

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int pos3;
int pos5,pos4;
   int len;
    int c1=0;
    int c=0;
    int c2=0;
    int pos1,pos,pos2;
    char str[5000];
    cin.getline(str,5000);
    len=strlen(str);

    if(!(str[0]=='a'&&str[len-1]=='c'))
    {
       cout<<"NO";
       exit(0);
    }
    for(int i=0;i<len;i++)
    {

        if(str[i]=='a')
    {
         pos=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='b')
    {
         pos1=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='c')
    {
         pos2=i;
        break;

    }
    }

    for(int i=0;i<len;i++)

{

    if(str[i]=='a')
    {
        c2++;
        pos3=i;
    }

     if(str[i]=='b')
        {

            c++;
            pos4=i;
        }
        if(str[i]=='c')
        {
          pos5=i;
            c1++;
        }

    }

    if((pos1>pos)&&(pos2>pos1)&&(pos1>pos3)&&(pos5>pos4)&&(pos4>pos3)&&(pos5>pos1)&&(pos4>pos)&&(pos2>pos4))
    {

    if((c1==c2||c1==c)&&(c1>0)&&(c>0)&&(c2>0))
    {

        cout<<"YES";
    }
    else{cout<<"NO";

    }
    }
     else
        cout<<"NO";

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int pos3;
int pos5,pos4;
   int len;
    int c1=0;
    int c=0;
    int c2=0;
    int pos1,pos,pos2;
    char str[5005];
    cin>>str;
    len=strlen(str);

    if(!(str[0]=='a'&&str[len-1]=='c'))
    {
       cout<<"NO";
       return 0;
    }
    for(int i=0;i<len;i++)
    {

        if(str[i]=='a')
    {
         pos=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='b')
    {
         pos1=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='c')
    {
         pos2=i;
        break;

    }
    }

    for(int i=0;i<len;i++)

{

    if(str[i]=='a')
    {
        c2++;
        pos3=i;
    }

     if(str[i]=='b')
        {

            c++;
            pos4=i;
        }
        if(str[i]=='c')
        {
          pos5=i;
            c1++;
        }

    }

    if((pos1>pos3)&&(pos2>pos4))
    {

    if((c1==c2||c1==c)&&(c1>0)&&(c>0)&&(c2>0))
    {

        cout<<"YES";
    }

    }
     else
        cout<<"NO";

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int pos3;
int pos5,pos4;
   int len;
    int c1=0;
    int c=0;
    int c2=0;
    int pos1,pos,pos2;
    char str[5005];
    cin.getline(str,5005);
    len=strlen(str);

    if(!(str[0]=='a'&&str[len-1]=='c'))
    {
       cout<<"NO";
       return 0;
    }
    for(int i=0;i<len;i++)
    {

        if(str[i]=='a')
    {
         pos=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='b')
    {
         pos1=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='c')
    {
         pos2=i;
        break;

    }
    }

    for(int i=0;i<len;i++)

{

    if(str[i]=='a')
    {
        c2++;
        pos3=i;
    }

     if(str[i]=='b')
        {

            c++;
            pos4=i;
        }
        if(str[i]=='c')
        {
          pos5=i;
            c1++;
        }

    }

    if((pos1>pos3)&&(pos2>pos4))
    {

    if((c1==c2||c1==c)&&(c1>0)&&(c>0)&&(c2>0))
    {

        cout<<"YES";
    }

    }
     else
        cout<<"NO";

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int pos3;
int pos5,pos4;
   int len;
   int i,j,k;
    int c1=0;
    int c=0;
    int c2=0;
    int pos1,pos,pos2;
    char str[10000];
    cin.getline(str,10000,'\n');
    len=strlen(str);
     for( i=0;i<len;i++)
    {

        if(str[i]=='a')
    {
         c++;
    }
    else

        break;
    }
         for(j=i;j<len;j++)
    {

        if(str[j]=='b'&&(str[j]!='a')&&(str[j]!='c'))
    {
         c1++;
    }
    else
        break;

    }
        for( k=j;k<len;k++)
    {

        if(str[k]=='c')
    {
         pos2=i;
         c2++;
    }
    else
        break;

    }

    if((c1==c2||c2==c)&&(c1>0)&&(c>0)&&(c2>0))
    {

        cout<<"YES";
    }

         else
        cout<<"NO";

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int pos3;
int pos5,pos4;
   int len;
    int c1=0;
    int c=0;
    int c2=0;
    int pos1,pos,pos2;
    char str[5000];
    cin.getline(str,5000);
    len=strlen(str);

    if(!(str[0]=='a'&&str[len-1]=='c'))
    {
       cout<<"NO";
       exit(0);
    }
    for(int i=0;i<len;i++)
    {

        if(str[i]=='a')
    {
         pos=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='b')
    {
         pos1=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='c')
    {
         pos2=i;
        break;

    }
    }

    for(int i=0;i<len;i++)

{

    if(str[i]=='a')
    {
        c2++;
        pos3=i;
    }

     if(str[i]=='b')
        {

            c++;
            pos4=i;
        }
        if(str[i]=='c')
        {
          pos5=i;
            c1++;
        }

    }

    if((pos1>pos)&&(pos2>pos1)&&(pos1>pos3)&&(pos5>pos4)&&(pos4>pos3)&&(pos5>pos1)&&(pos4>pos)&&(pos2>pos4))
    {

    if((c1==c2||c1==c)&&(c1>0)&&(c>0)&&(c2>0))
    {

        cout<<"YES";
    }
    }
     else
        cout<<"NO";


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int pos3;
int pos5,pos4;
   int len;
   int i,j,k;
    int c1=0;
    int c=0;
    int c2=0;
    int pos1,pos,pos2;
    char str[10000];
    cin.getline(str,10000,'\n');
    len=strlen(str);
     for( i=0;i<len;i++)
    {

        if(str[i]=='a')
    {
         c++;
    }
    else

        break;
    }
         for(j=i;j<len;j++)
    {

        if((str[j]=='b')&&(str[j]!='a')&&(str[j]!='c'))
    {
         c1++;
    }
    else
        break;

    }
        for( k=j;k<len;k++)
    {

        if(str[k]=='c')
    {
         pos2=i;
         c2++;
    }
    else
        break;

    }

    if((c1==c2||c2==c)&&(c1>0)&&(c>0)&&(c2>0))
    {

        cout<<"YES";
    }


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int pos3;
int pos5,pos4;
   int len;
   int i,j,k;
    int c1=0;
    int c=0;
    int c2=0;
    int pos1,pos,pos2;
    char str[10000];
    cin.getline(str,10000,'\n');
    len=strlen(str);
     for( i=0;i<len;i++)
    {

        if(str[i]=='a')
    {
         c++;
    }
    else

        break;
    }
         for(j=i;j<len;j++)
    {

        if((str[j]=='b')&&(str[j]!='a')&&(str[j]!='c'))
    {
         c1++;
    }
    else
        break;

    }
        for( k=j;k<len;k++)
    {

        if(str[k]=='c')
    {
         pos2=i;
         c2++;
    }
    else
        break;

    }

    if((c1==c2||c2==c)&&(c1>0)&&(c>0)&&(c2>0))
    {

        cout<<"YES";
    }

         else
        cout<<"NO";

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int pos3;
int pos5,pos4;
   int len;
    int c1=0;
    int c=0;
    int c2=0;
    int pos1,pos,pos2;
    char str[5000];
    cin.getline(str,5000);
    len=strlen(str);

    if(!(str[0]=='a'&&str[len-1]=='c'))
    {
       cout<<"NO";
       exit(0);
    }
    for(int i=0;i<len;i++)
    {

        if(str[i]=='a')
    {
         pos=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='b')
    {
         pos1=i;
        break;

    }
    }
     for(int i=0;i<len;i++)
    {

        if(str[i]=='c')
    {
         pos2=i;
        break;

    }
    }

    for(int i=0;i<len;i++)

{

    if(str[i]=='a')
    {
        c2++;
        pos3=i;
    }

     if(str[i]=='b')
        {

            c++;
            pos4=i;
        }
        if(str[i]=='c')
        {
          pos5=i;
            c1++;
        }

    }

    if((pos1>pos)&&(pos2>pos1)&&(pos1>pos3)&&(pos5>pos4)&&(pos4>pos3)&&(pos5>pos1)&&(pos4>pos)&&(pos2>pos4))
    {

    if((c1==c2||c1==c)&&(c1>0)&&(c>0)&&(c2>0))
    {

        cout<<"YES";
    }

    }
     else
        cout<<"NO";

}


#pragma comment(linker,"/stack:67108864")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <sstream>
#include <fstream>
#include <climits>
#include <cfloat>
#include <functional>
#include <ctime>
#include <numeric>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <utility>
#include <bitset>
#include <string>
#include <list>
#include <stack>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <typeinfo>
#include <cassert>
#include <ctime>

using namespace std;

#define forn(i,n) for(int i=0;i<int(n);++i)
#define forn1(i,n) for(int i=1;i<=int(n);++i)
#define ford(i,n) for(int i=int(n)-1;i>=0;--i)
#define ford1(i,n) for(int i=int(n);i>0;--i)
#define foran(i,l,r) for(int i=int(l);i<int(r);++i)

#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define sqr(x) (x)*(x)
#define all(v) (v).begin(),(v).end()

typedef long double ld;
typedef long long ll;
typedef pair <ld ,ld > pt;

const ld EPS=1e-9;
const ld PI=3.1415926535897932384626433832795;

const ll INF=1e15;

struct cur
{
    char a; char b; char c; char d;
};

int main()
{
    ifstream ifile("input.txt");
    if (ifile)  freopen("input.txt", "rt", stdin);
#ifdef ONLINE_JUDGE
    if (ifile) freopen("output.txt","wt",stdout);
#endif
    int n;
    while(cin >>n)
    {
        vector<cur> a(n);
        if(n==1)
        {
            cout <<'x'<<endl<<'x'<<endl<<'y'<<endl<<'y'<<endl;
            continue;
        }
        a[0].a='x';
        a[1].a='x';
        a[0].b='y';
        a[1].b='y';
        a[0].c='x';
        a[1].c='x';
        a[0].d='y';
        a[1].d='y';
        foran(i,2,n)
        {
            a[i].a='a'+(i%2?2:0);
            a[i].b='a'+(i%2?2:0);
            a[i].c='b'+(i%2?2:0);
            a[i].d='b'+(i%2?2:0);
        }
        forn(i,n) cout <<a[i].a;
        cout <<endl;
        forn(i,n) cout <<a[i].b;
        cout <<endl;
        forn(i,n) cout <<a[i].c;
        cout <<endl;
        forn(i,n) cout <<a[i].d;
        cout <<endl;
    }
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;

void solve(){
    int n;
    cin >> n;

    for(int i = 0; i < 4; i++){
        if(i <= 1){
            for(int j = 0; j < n; j++){
                if(j % 2)
                    cout << "a" << flush;
                else
                    cout << "c" << flush;
            }
            cout << endl;
        }
        else{
            for(int j = 0; j < n; j++){
                if(j % 2)
                    cout << "b" << flush;
                else
                    cout << "d" << flush;
            }
            cout << endl;
        }
    }

}
int main(){

    solve();

    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;

void solve(){
    int n;
    cin >> n;

    if(n == 1){
        cout << "a" << endl;
        cout << "b" << endl;
        cout << "c" << endl;
        cout << "d" << endl;
        return;
    }

    for(int i = 0; i < 4; i++){
        if(n%2==0){
            if(i == 0){
                for(int j = 0; j < n/2; j++){
                    if(j %2){
                        cout << "aa" << flush;
                    }
                    else{
                        cout << "bb" << flush;
                    }
                }
                cout << endl;
            }
            else if(i == 1){
                cout << "h" << flush;
                for(int j = 0; j < (n-2)/2; j++){
                    if(j % 2){
                        cout << "dd" << flush;
                    }
                    else
                        cout << "ee" << flush;
                }
                cout << "g" << flush;
                cout << endl;
            }
            else if(i == 2){
                cout << "h" << flush;
                for(int j = 0; j < (n-2)/2; j++){
                    if(j % 2){
                        cout << "ee" << flush;
                    }
                    else
                        cout << "dd" << flush;
                }
                cout << "g" << flush;
                cout << endl;
            }
            else if(i == 3){
                for(int j = 0; j < n/2; j++){
                    if(j %2){
                        cout << "aa" << flush;
                    }
                    else{
                        cout << "bb" << flush;
                    }
                }
                cout << endl;
            }
        }
        else{
            if(i == 0){
                for(int j = 0; j<n/2; j++){
                    if(j%2)
                        cout << "aa" << flush;
                    else
                        cout << "bb" << flush;
                }
                cout << "c" << flush;
                cout << endl;
            }
            else if(i == 1){
                for(int j = 0; j<n/2; j++){
                    if(j%2)
                        cout << "bb" << flush;
                    else
                        cout << "aa" << flush;
                }
                cout << "c" << flush;
                cout << endl;
            }
            else if(i == 2){
                cout << "c" << flush;
                for(int j = 0; j<n/2; j++){
                    if(j%2)
                        cout << "dd" << flush;
                    else
                        cout << "ee" << flush;
                }
                cout << endl;
            }
            else if(i == 3){
                cout << "c" << flush;
                for(int j = 0; j<n/2; j++){
                    if(j%2)
                        cout << "ee" << flush;
                    else
                        cout << "dd" << flush;
                }
                cout << endl;
            }
        }
    }

}

int main(){

    solve();

    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;

void solve(){
    int n;
    cin >> n;

    for(int i = 0; i < 4; i++){
        if(n%2==0){
            if(i == 0){
                for(int j = 0; j < n/2; j++){
                    if(j %2){
                        cout << "aa" << flush;
                    }
                    else{
                        cout << "bb" << flush;
                    }
                }
                cout << endl;
            }
            else if(i == 1){
                cout << "g" << flush;
                for(int j = 0; j < (n-2)/2; j++){
                    if(j % 2){
                        cout << "dd" << flush;
                    }
                    else
                        cout << "ee" << flush;
                }
                cout << "g" << flush;
                cout << endl;
            }
            else if(i == 2){
                cout << "g" << flush;
                for(int j = 0; j < (n-2)/2; j++){
                    if(j % 2){
                        cout << "ee" << flush;
                    }
                    else
                        cout << "dd" << flush;
                }
                cout << "g" << flush;
                cout << endl;
            }
            else if(i == 3){
                for(int j = 0; j < n/2; j++){
                    if(j %2){
                        cout << "aa" << flush;
                    }
                    else{
                        cout << "bb" << flush;
                    }
                }
                cout << endl;
            }
        }
        else{
            if(i == 0){
                for(int j = 0; j<n/2; j++){
                    if(j%2)
                        cout << "aa" << flush;
                    else
                        cout << "bb" << flush;
                }
                cout << "c" << flush;
                cout << endl;
            }
            else if(i == 1){
                for(int j = 0; j<n/2; j++){
                    if(j%2)
                        cout << "bb" << flush;
                    else
                        cout << "aa" << flush;
                }
                cout << "c" << flush;
                cout << endl;
            }
            else if(i == 2){
                cout << "c" << flush;
                for(int j = 0; j<n/2; j++){
                    if(j%2)
                        cout << "dd" << flush;
                    else
                        cout << "ee" << flush;
                }
                cout << endl;
            }
            else if(i == 3){
                cout << "c" << flush;
                for(int j = 0; j<n/2; j++){
                    if(j%2)
                        cout << "ee" << flush;
                    else
                        cout << "dd" << flush;
                }
                cout << endl;
            }
        }
    }

}

int main(){

    solve();

    return 0;
}