#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long int
#define MOD 1000000007
#define INF 100000000000000 //INF - 1e14
#define vi vector<ll>
#define pb push_back
#define mpl map<ll,ll>
#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll> >
#define fer(i, a, n) for( ll i = a; i <= n; i++)
#define fdr(i, a, n) for( ll i = a; i >= n; i--)
#define invec(n,v) vi v(n); fer(i,0,n-1) cin >> v[i]
#define insvec(n,v) rin(n); vi v(n); fer(i,0,n-1) cin >> v[i]
#define MK2DV(v,row,col,val) vector<vector<ll> > v(row, vector<ll>(col,val))
#define matrix vector<vector<ll> >
#define printpartition cout << "-------------------------------------------------------------" << endl;
#define printmat(mat,row,col) cout << #mat << "::" << endl; fer(i,0,row-1)fer(j,0,col-1)cout << mat[i][j] << " \n"[j == col-1]; printpartition;
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i : x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
template <typename T> inline void inp(T &any) {cin >> any;} template <typename T, typename... U>inline void inp(T &a, U &...b) {cin >> a; inp(b...);}
#define rin(args...) ll args; inp(args);
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#define matdeb(mat,row,col) printmat(mat,row,col);
#else
#define debug(x...)
#define matdeb(mat,row,col)
#endif
ll fast_pow(ll base, ll exp, ll M = MOD) { base = base % M; ll result = 1; while (exp > 0) { if (exp % 2 == 1) result = (result * base) % M; base = (base * base) % M; exp = exp / 2; } return result; }
ll modInverse(ll A, ll M = MOD) { return fast_pow(A, M - 2, M); } // only when M is prime
string yes = "YES", no = "NO";
string s1, s2;
ll cnt1[26][200000];
ll cnt2[26][200000];
bool cntalb(ll l1, ll r1, ll l2, ll r2) {
	fer(a, 0, 25) {
		ll count1 = cnt1[a][r1] - cnt1[a][l1] + (s1[l1] == 'a' + a);
		ll count2 = cnt2[a][r2] - cnt2[a][l2] + (s2[l2] == 'a' + a);
		if (count2 != count1)
			return false;
	}
	return true;
}
bool same(ll l1, ll r1, ll l2, ll r2) {
	ll sz = r1 - l1 + 1;
	if (r2 - l2 + 1 != sz) return false;
	fer(i, 0, sz - 1) {
		// debug(l1 + i);
		// debug(i, s1[l1 + i], s2[l2 + i]);
		if (s1[l1 + i] != s2[l2 + i])
			return false;
	}
	return true;
}

bool func(ll l1, ll r1, ll l2, ll r2) {
	ll n = r1 - l1 + 1;
	debug(l1, r1, l2, r2);
	// debug(cntalb(l1, r1, l2, r2));
	if (cntalb(l1, r1, l2, r2)) {
		bool b = same(l1, r1, l2, r2);
		// debug(b);
		if (b || (n & 1)) {
			return b;
		}
		bool res = false;
		res |= func(l1, l1 + n / 2 - 1, l2, l2 + n / 2 - 1) && func(l1 + n / 2, r1, l2 + n / 2, r2);
		res |= func(l1, l1 + n / 2 - 1, l2 + n / 2, r2) && func(l1 + n / 2, r1, l2, l2 + n / 2 - 1);
		return res;
	}
	return false;
}
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("intt.txt", "r", stdin);
	freopen("outt.txt", "w", stdout);
#endif

	ll test_cases = 1;
	// cin >> test_cases;
	for (ll test_case = 1; test_case <= test_cases; test_case++) {
		// cout << "Case #" << test_case << ": ";
		// string s1, s2;
		cin >> s1 >> s2;
		debug(s1, s2);
		ll n = s1.size();
		if (s2.size() != n) {
			cout << no;
			return 0;
		}
		cnt1[s1[0] - 'a'][0]++;
		cnt2[s2[0] - 'a'][0]++;
		fer(i, 1, n - 1) {
			debug(i);
			fer(ch, 0, 25) {
				cnt1[ch][i] = cnt1[ch][i - 1] + (s1[i] == 'a' + ch);
				cnt2[ch][i] = cnt2[ch][i - 1] + (s2[i] == 'a' + ch);
			}
		}
		debug("dne");
		matdeb(cnt1, 5, 4);
		matdeb(cnt2, 5, 4);
		if (n & 1) {
			if (s1 == s2)
				cout << yes;
			else
				cout << no;
		}
		bool res = func(0, n - 1, 0, n - 1);
		debug(res);
		if (res)
			cout << yes;
		else
			cout << no;

	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define fer(i, a, n) for( ll i = a; i <= n; i++)
using namespace std;
string s1, s2;
ll cnt1[26][200000];
ll cnt2[26][200000];
bool cntalb(ll l1, ll r1, ll l2, ll r2) {
	ll count1, count2;
	ll n = r1 - l1 + 1;
	if (1) {
		fer(a, 0, 25) {
			count1 = cnt1[a][r1] - cnt1[a][l1] + (s1[l1] == 'a' + a);
			count2 = cnt2[a][r2] - cnt2[a][l2] + (s2[l2] == 'a' + a);
			if (count2 != count1)
				return false;
		}
	}
	return true;
}
bool same(ll l1, ll r1, ll l2, ll r2) {
	ll sz = r1 - l1 + 1;
	if (r2 - l2 + 1 != sz) return false;
	fer(i, 0, sz - 1) {
		if (s1[l1 + i] != s2[l2 + i])
			return false;
	}
	return true;
}

bool func(ll l1, ll r1, ll l2, ll r2) {
	ll n = r1 - l1 + 1;
	if (cntalb(l1, r1, l2, r2)) {
		bool b = same(l1, r1, l2, r2);
		if (b | (n & 1)) {
			return b;
		}
		bool res = false;
		res |= func(l1, l1 + n / 2 - 1, l2, l2 + n / 2 - 1) && func(l1 + n / 2, r1, l2 + n / 2, r2);
		// if (!res)
		res |= func(l1, l1 + n / 2 - 1, l2 + n / 2, r2) && func(l1 + n / 2, r1, l2, l2 + n / 2 - 1);
		return res;
	}
	return false;
}
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("intt.txt", "r", stdin);
	freopen("outt.txt", "w", stdout);
#endif
	cin >> s1 >> s2;
	ll n = s1.size();
	if (s2.size() != n) {
		cout << "NO";
		return 0;
	}
	cnt1[s1[0] - 'a'][0]++;
	cnt2[s2[0] - 'a'][0]++;
	fer(i, 1, n - 1) {
		fer(ch, 0, 25) {
			cnt1[ch][i] = cnt1[ch][i - 1] + (s1[i] == 'a' + ch);
			cnt2[ch][i] = cnt2[ch][i - 1] + (s2[i] == 'a' + ch);
		}
	}
	if (n & 1) {
		if (s1 == s2)
			cout << "YES";
		else
			cout << "NO";
		return 0;
	}
	if (func(0, n - 1, 0, n - 1))
		cout << "YES";
	else
		cout << "NO";
	return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define fer(i, a, n) for( ll i = a; i <= n; i++)
using namespace std;
string s1, s2;
ll cnt1[26][200000];
ll cnt2[26][200000];
bool cntalb(ll l1, ll r1, ll l2, ll r2) {
	ll count1, count2;
	ll n = r1 - l1 + 1;
	if (1) {
		fer(a, 0, 25) {
			count1 = cnt1[a][r1] - cnt1[a][l1] + (s1[l1] == 'a' + a);
			count2 = cnt2[a][r2] - cnt2[a][l2] + (s2[l2] == 'a' + a);
			if (count2 != count1)
				return false;
		}
	}
	return true;
}
bool same(ll l1, ll r1, ll l2, ll r2) {
	ll sz = r1 - l1 + 1;
	if (r2 - l2 + 1 != sz) return false;
	fer(i, 0, sz - 1) {
		if (s1[l1 + i] != s2[l2 + i])
			return false;
	}
	return true;
}

bool func(ll l1, ll r1, ll l2, ll r2) {
	ll n = r1 - l1 + 1;
	if (cntalb(l1, r1, l2, r2)) {
		bool b = same(l1, r1, l2, r2);
		if (b | (n & 1)) {
			return b;
		}
		bool res = false;
		res |= func(l1, l1 + n / 2 - 1, l2, l2 + n / 2 - 1) && func(l1 + n / 2, r1, l2 + n / 2, r2);
		if (!res)
			res |= func(l1, l1 + n / 2 - 1, l2 + n / 2, r2) && func(l1 + n / 2, r1, l2, l2 + n / 2 - 1);
		return res;
	}
	return false;
}
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("intt.txt", "r", stdin);
	freopen("outt.txt", "w", stdout);
#endif
	cin >> s1 >> s2;
	ll n = s1.size();
	if (s2.size() != n) {
		cout << "NO";
		return 0;
	}
	cnt1[s1[0] - 'a'][0]++;
	cnt2[s2[0] - 'a'][0]++;
	fer(i, 1, n - 1) {
		fer(ch, 0, 25) {
			cnt1[ch][i] = cnt1[ch][i - 1] + (s1[i] == 'a' + ch);
			cnt2[ch][i] = cnt2[ch][i - 1] + (s2[i] == 'a' + ch);
		}
	}
	if (n & 1) {
		if (s1 == s2)
			cout << "YES";
		else
			cout << "NO";
		return 0;
	}
	if (func(0, n - 1, 0, n - 1))
		cout << "YES";
	else
		cout << "NO";
	return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define fer(i, a, n) for( int i = a; i <= n; i++)
using namespace std;
string s1, s2;
int cnt1[26][200000];
int cnt2[26][200000];
bool cntalb(int l1, int r1, int l2, int r2) {
	int count1, count2;
	int n = r1 - l1 + 1;
	if (n > 26) {
		fer(a, 0, 25) {
			count1 = cnt1[a][r1] - cnt1[a][l1] + (s1[l1] == 'a' + a);
			count2 = cnt2[a][r2] - cnt2[a][l2] + (s2[l2] == 'a' + a);
			if (count2 != count1)
				return false;
		}
	}
	else {
		fer(i, l1, r1) {
			int ch = s1[i] - 'a';
			count1 = cnt1[s1[i] - 'a'][r1] - cnt1[s1[i] - 'a'][l1] + (s1[l1] == s1[i]);
			count2 = cnt2[s1[i] - 'a'][r2] - cnt2[s1[i] - 'a'][l2] + (s2[l2] == 'a' + ch);
			if (count2 != count1)
				return false;
		}
	}
	return true;
}
bool same(int l1, int r1, int l2, int r2) {
	int sz = r1 - l1 + 1;
	if (r2 - l2 + 1 != sz) return false;
	fer(i, 0, sz - 1) {
		if (s1[l1 + i] != s2[l2 + i])
			return false;
	}
	return true;
}

bool func(int l1, int r1, int l2, int r2) {
	int n = r1 - l1 + 1;
	if (cntalb(l1, r1, l2, r2)) {
		bool b = same(l1, r1, l2, r2);
		if (b | (n & 1)) {
			return b;
		}
		bool res = false;
		res |= func(l1, l1 + n / 2 - 1, l2, l2 + n / 2 - 1) && func(l1 + n / 2, r1, l2 + n / 2, r2);
		if (!res)
			res |= func(l1, l1 + n / 2 - 1, l2 + n / 2, r2) && func(l1 + n / 2, r1, l2, l2 + n / 2 - 1);
		return res;
	}
	return false;
}
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("intt.txt", "r", stdin);
	freopen("outt.txt", "w", stdout);
#endif
	cin >> s1 >> s2;
	int n = s1.size();
	if (s2.size() != n) {
		cout << "NO";
		return 0;
	}
	cnt1[s1[0] - 'a'][0]++;
	cnt2[s2[0] - 'a'][0]++;
	fer(i, 1, n - 1) {
		fer(ch, 0, 25) {
			cnt1[ch][i] = cnt1[ch][i - 1] + (s1[i] == 'a' + ch);
			cnt2[ch][i] = cnt2[ch][i - 1] + (s2[i] == 'a' + ch);
		}
	}
	if (n & 1) {
		if (s1 == s2)
			cout << "YES";
		else
			cout << "NO";
		return 0;
	}
	if (func(0, n - 1, 0, n - 1))
		cout << "YES";
	else
		cout << "NO";
	return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define fer(i, a, n) for( int i = a; i <= n; i++)
using namespace std;
string s1, s2;
int cnt1[26][200000];
int cnt2[26][200000];
bool cntalb(int l1, int r1, int l2, int r2) {
	int count1, count2;
	int n = r1 - l1 + 1;
	if (1) {
		fer(a, 0, 25) {
			count1 = cnt1[a][r1] - cnt1[a][l1] + (s1[l1] == 'a' + a);
			count2 = cnt2[a][r2] - cnt2[a][l2] + (s2[l2] == 'a' + a);
			if (count2 != count1)
				return false;
		}
	}
	return true;
}
bool same(int l1, int r1, int l2, int r2) {
	int sz = r1 - l1 + 1;
	if (r2 - l2 + 1 != sz) return false;
	fer(i, 0, sz - 1) {
		if (s1[l1 + i] != s2[l2 + i])
			return false;
	}
	return true;
}

bool func(int l1, int r1, int l2, int r2) {
	int n = r1 - l1 + 1;
	if (cntalb(l1, r1, l2, r2)) {
		bool b = same(l1, r1, l2, r2);
		if (b | (n & 1)) {
			return b;
		}
		bool res = false;
		res |= func(l1, l1 + n / 2 - 1, l2, l2 + n / 2 - 1) && func(l1 + n / 2, r1, l2 + n / 2, r2);
		if (!res)
			res |= func(l1, l1 + n / 2 - 1, l2 + n / 2, r2) && func(l1 + n / 2, r1, l2, l2 + n / 2 - 1);
		return res;
	}
	return false;
}
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("intt.txt", "r", stdin);
	freopen("outt.txt", "w", stdout);
#endif
	cin >> s1 >> s2;
	int n = s1.size();
	if (s2.size() != n) {
		cout << "NO";
		return 0;
	}
	cnt1[s1[0] - 'a'][0]++;
	cnt2[s2[0] - 'a'][0]++;
	fer(i, 1, n - 1) {
		fer(ch, 0, 25) {
			cnt1[ch][i] = cnt1[ch][i - 1] + (s1[i] == 'a' + ch);
			cnt2[ch][i] = cnt2[ch][i - 1] + (s2[i] == 'a' + ch);
		}
	}
	if (n & 1) {
		if (s1 == s2)
			cout << "YES";
		else
			cout << "NO";
		return 0;
	}
	if (func(0, n - 1, 0, n - 1))
		cout << "YES";
	else
		cout << "NO";
	return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long int
#define MOD 1000000007
#define INF 100000000000000 //INF - 1e14
#define vi vector<ll>
#define pb push_back
#define mpl map<ll,ll>
#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll> >
#define fer(i, a, n) for( ll i = a; i <= n; i++)
#define fdr(i, a, n) for( ll i = a; i >= n; i--)
#define invec(n,v) vi v(n); fer(i,0,n-1) cin >> v[i]
#define insvec(n,v) rin(n); vi v(n); fer(i,0,n-1) cin >> v[i]
#define MK2DV(v,row,col,val) vector<vector<ll> > v(row, vector<ll>(col,val))
#define matrix vector<vector<ll> >
#define printpartition cout << "-------------------------------------------------------------" << endl;
#define printmat(mat,row,col) cout << #mat << "::" << endl; fer(i,0,row-1)fer(j,0,col-1)cout << mat[i][j] << " \n"[j == col-1]; printpartition;
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i : x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
template <typename T> inline void inp(T &any) {cin >> any;} template <typename T, typename... U>inline void inp(T &a, U &...b) {cin >> a; inp(b...);}
#define rin(args...) ll args; inp(args);
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#define matdeb(mat,row,col) printmat(mat,row,col);
#else
#define debug(x...)
#define matdeb(mat,row,col)
#endif
ll fast_pow(ll base, ll exp, ll M = MOD) { base = base % M; ll result = 1; while (exp > 0) { if (exp % 2 == 1) result = (result * base) % M; base = (base * base) % M; exp = exp / 2; } return result; }
ll modInverse(ll A, ll M = MOD) { return fast_pow(A, M - 2, M); } // only when M is prime
string yes = "YES", no = "NO";
string s1, s2;
ll cnt1[26][200000];
ll cnt2[26][200000];
bool cntalb(ll l1, ll r1, ll l2, ll r2) {
	fer(a, 0, 25) {
		ll count1 = cnt1[a][r1] - cnt1[a][l1] + (s1[l1] == 'a' + a);
		ll count2 = cnt2[a][r2] - cnt2[a][l2] + (s2[l2] == 'a' + a);
		if (count2 != count1)
			return false;
	}
	return true;
}
bool same(ll l1, ll r1, ll l2, ll r2) {
	ll sz = r1 - l1 + 1;
	if (r2 - l2 + 1 != sz) return false;
	fer(i, 0, sz - 1) {
		// debug(l1 + i);
		// debug(i, s1[l1 + i], s2[l2 + i]);
		if (s1[l1 + i] != s2[l2 + i])
			return false;
	}
	return true;
}

bool func(ll l1, ll r1, ll l2, ll r2) {
	ll n = r1 - l1 + 1;
	debug(l1, r1, l2, r2);
	// debug(cntalb(l1, r1, l2, r2));
	if (cntalb(l1, r1, l2, r2)) {
		bool b = same(l1, r1, l2, r2);
		// debug(b);
		if (b || (n & 1)) {
			return b;
		}
		bool res = false;
		res |= func(l1, l1 + n / 2 - 1, l2, l2 + n / 2 - 1) && func(l1 + n / 2, r1, l2 + n / 2, r2);
		res |= func(l1, l1 + n / 2 - 1, l2 + n / 2, r2) && func(l1 + n / 2, r1, l2, l2 + n / 2 - 1);
		return res;
	}
	return false;
}
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("intt.txt", "r", stdin);
	freopen("outt.txt", "w", stdout);
#endif

	ll test_cases = 1;
	// cin >> test_cases;
	for (ll test_case = 1; test_case <= test_cases; test_case++) {
		// cout << "Case #" << test_case << ": ";
		// string s1, s2;
		cin >> s1 >> s2;
		debug(s1, s2);
		ll n = s1.size();
		if (s2.size() != n) {
			cout << no;
			return 0;
		}
		cnt1[s1[0] - 'a'][0]++;
		cnt2[s2[0] - 'a'][0]++;
		fer(i, 1, n - 1) {
			debug(i);
			fer(ch, 0, 25) {
				cnt1[ch][i] = cnt1[ch][i - 1] + (s1[i] == 'a' + ch);
				cnt2[ch][i] = cnt2[ch][i - 1] + (s2[i] == 'a' + ch);
			}
		}
		debug("dne");
		matdeb(cnt1, 5, 4);
		matdeb(cnt2, 5, 4);
		if (n & 1) {
			if (s1 == s2)
				cout << yes;
			else
				cout << no;
			return 0;
		}
		bool res = func(0, n - 1, 0, n - 1);
		debug(res);
		if (res)
			cout << yes;
		else
			cout << no;

	}
	return 0;
}


/*Ankon Ghosh
  KUET,ECE 2K16*/
#include<bits/stdc++.h>
///#include <ext/pb_ds/assoc_container.hpp> // Common file
///#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
///#include <ext/pb_ds/detail/standard_policies.hpp>
///using namespace __gnu_pbds;
using namespace std;
using ll =long long int;
#define inf 9e18
#define MAX 200004
#define mod 1000000007
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define Case(i) printf("Case %lld: ",i)
#define setpre(number) cout<<fixed<<setprecision(10)<<number<<endl
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n",a,b)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define LOOP(x,y) for(ll i=x;i<=y;i++)
#define RFOR(i,n) for(ll i=n-1;i>=0;i--)
#define RFOR1(i,n) for(ll i=n;i>0;i--)
#define RLOOP(x,y) for(ll i=y;i>=x;i--)
#define m_p make_pair
#define ff first
#define ss second
#define p_b push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
///map<ll,ll>mp1,mp;
vector<pair<ll,pair<ll,ll> > >vpp1;
vector<pair<ll,ll> >vp,vp1;
vector<ll>v,v1,v2,fin;
map<pair<ll,ll>,bool>mbb;
map<ll,bool>mb;
ll n,a,b,c,d,e,f,ta,sum=0,cnt=0,m,l,req,sz,maxi,k;
bool sortbysec(const pair<pair<ll,ll>,ll> &a,const pair<pair<ll,ll>,ll> &b)
{
    return (a.second < b.second);
}
string s,t;
queue<pair<ll,pair<string,string> > >q;
void solve(string reff)
{
    mb.clear();
    bool flag=0;
    ll cnt=0;
    ll itr=2;
    while(!q.empty())
    {
        ll now=q.front().ff;
        if(mb[now])
        {
            q.pop();
            continue;
        }
        string s=q.front().ss.ff;
        string t=q.front().ss.ss;
        if(s.size()%2==1)
        {
            if(s==t)
            {
                ///cout<<s<<" "<<t<<endl;
                mb[now]=1;
                cnt+=s.size();
            }
            q.pop();
        }
        else
        {
            if(s==t)
            {
                ///cout<<s<<" "<<t<<endl;
                mb[now]=1;
                cnt+=s.size();
                q.pop();
            }
            else
            {
                string s1=s.substr(0LL,s.size()/2);
                string s2=s.substr(s.size()/2,s.size()/2);
                string t1=t.substr(0LL,t.size()/2);
                string t2=t.substr(t.size()/2,t.size()/2);
                q.pop();
                if(s1==t1)
                {
                    cnt+=s1.size();
                    ///cout<<s1<<" "<<t1<<endl;
                    if(s2!=t2) q.push({itr++,{s2,t2}});
                    else{
                        cnt+=s2.size();
                        cout<<s2<<" "<<t2<<endl;
                    }
                }
                else if(s1==t2)
                {
                    cnt+=s1.size();
                    ///cout<<s1<<" "<<t2<<endl;
                    if(s2!=t1) q.push({itr++,{s2,t1}});
                    else
                    {
                        cnt+=s2.size();
                    }
                }
            }
        }
    }
    ///cout<<cnt<<endl;
    if(cnt<reff.size()) cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
}
int main()
{
    fast;
    cin>>s>>t;
    q.push({1LL,{s,t}});
    solve(s);
    return 0;
}


/*Ankon Ghosh
  KUET,ECE 2K16*/
#include<bits/stdc++.h>
///#include <ext/pb_ds/assoc_container.hpp> // Common file
///#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
///#include <ext/pb_ds/detail/standard_policies.hpp>
///using namespace __gnu_pbds;
using namespace std;
using ll =long long int;
#define inf 9e18
#define MAX 200004
#define mod 1000000007
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define Case(i) printf("Case %lld: ",i)
#define setpre(number) cout<<fixed<<setprecision(10)<<number<<endl
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n",a,b)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define LOOP(x,y) for(ll i=x;i<=y;i++)
#define RFOR(i,n) for(ll i=n-1;i>=0;i--)
#define RFOR1(i,n) for(ll i=n;i>0;i--)
#define RLOOP(x,y) for(ll i=y;i>=x;i--)
#define m_p make_pair
#define ff first
#define ss second
#define p_b push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
///map<ll,ll>mp1,mp;
vector<pair<ll,pair<ll,ll> > >vpp1;
vector<pair<ll,ll> >vp,vp1;
vector<ll>v,v1,v2,fin;
map<pair<ll,ll>,bool>mbb;
map<ll,bool>mb;
ll n,a,b,c,d,e,f,ta,sum=0,cnt=0,m,l,req,sz,maxi,k;
bool sortbysec(const pair<pair<ll,ll>,ll> &a,const pair<pair<ll,ll>,ll> &b)
{
    return (a.second < b.second);
}
string s,t;
queue<pair<ll,pair<string,string> > >q;
string smallest(string s)
{
    if(s.size()%2==1) return s;
    string s1=smallest(s.substr(0LL,s.size()/2));
    string s2=smallest(s.substr(s.size()/2,s.size()/2));
    if(s1>s2) return s2+s1;
    else return s1+s2;
}
int main()
{
    fast;
    cin>>s>>t;
    ///q.push({1LL,{s,t}});
    s=smallest(s);
    t=smallest(t);
    ///cout<<s<<" "<<t<<endl;
    if(s==t) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


/*Ankon Ghosh
  KUET,ECE 2K16*/
#include<bits/stdc++.h>
///#include <ext/pb_ds/assoc_container.hpp> // Common file
///#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
///#include <ext/pb_ds/detail/standard_policies.hpp>
///using namespace __gnu_pbds;
using namespace std;
using ll =long long int;
#define inf 9e18
#define MAX 200004
#define mod 1000000007
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define Case(i) printf("Case %lld: ",i)
#define setpre(number) cout<<fixed<<setprecision(10)<<number<<endl
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n",a,b)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define LOOP(x,y) for(ll i=x;i<=y;i++)
#define RFOR(i,n) for(ll i=n-1;i>=0;i--)
#define RFOR1(i,n) for(ll i=n;i>0;i--)
#define RLOOP(x,y) for(ll i=y;i>=x;i--)
#define m_p make_pair
#define ff first
#define ss second
#define p_b push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
///map<ll,ll>mp1,mp;
vector<pair<ll,pair<ll,ll> > >vpp1;
vector<pair<ll,ll> >vp,vp1;
vector<ll>v,v1,v2,fin;
map<pair<ll,ll>,bool>mbb;
map<ll,bool>mb;
ll n,a,b,c,d,e,f,ta,sum=0,cnt=0,m,l,req,sz,maxi,k;
bool sortbysec(const pair<pair<ll,ll>,ll> &a,const pair<pair<ll,ll>,ll> &b)
{
    return (a.second < b.second);
}
string s,t;
queue<pair<ll,pair<string,string> > >q;
string smallest(string s)
{
    if(s.size()%2==1) return s;
    string s1=smallest(s.substr(0LL,s.size()/2));
    string s2=smallest(s.substr(s.size()/2,s.size()/2));
    if(s1<s2) return s2+s1;
    else return s1+s2;
}
int main()
{
    fast;
    cin>>s>>t;
    ///q.push({1LL,{s,t}});
    s=smallest(s);
    t=smallest(t);
    ///cout<<s<<" "<<t<<endl;
    if(s==t) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


/*
------------------------------------------------------

    Dilon Mein Tum Apni Betaabiyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.

    Nazar Mein Khwabon Ki Bijliyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.

    Hawa Ke Jhokon Ke Jaise Aazad Rehno Sikho,
    Tum Ek Dariya Ke Jaise Lehron Mein Behna Sikho,
    Har Ek lamhe Se Tum Milo Khole Apni Bhaahein,
    Har Ek Pal Ek Naya Sama Dekhen Yeh Nigahaein,

    Jo Apni Aankhon Mein Hairaniyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.

    Dilon Mein Tum Apni Betaabiyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.

    - Imran ( Zindagi Na Milegi Dobara )

-------------------------------------------------------

	Author :- Gaurang_Kothiya
	Nirma University

*/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> data_set;
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ld long double
#define f(i,x,n) for(auto i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(auto i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()
#define gcd(a,b) __gcd(a,b)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define RE rend()
#define RB rbegin()
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map
#define u_m(a,b) unordered_map
#define mm(a,b) multimap
#define s(a) set
#define us(a) unordered_set
#define ms(a) multiset
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846

bool eq(string s,string t)
{
	if(s==t) return true;
	if(s.length()==1)
	{
		if(s!=t) return false;
		else return true;
	}
	int n=s.length();
	string s1=s.substr(0,n/2);
	string s2=s.substr(n/2,n/2);
	string t1=t.substr(0,n/2);
	string t2=t.substr(n/2,n/2);
	return (eq(s1,t1)&&eq(s2,t2))||(eq(s1,t2)&&eq(s2,t1));
}

void Solve()
{
	string a,b;
	cin>>a>>b;
	if(eq(a,b)) cout<<"YES";
	else cout<<"NO";
}

signed main()
{
	speed

	int q=1;
	//cin>>q;

	while(q--)
	Solve();

	//cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
	return 0;
}


/*
------------------------------------------------------

    Dilon Mein Tum Apni Betaabiyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.

    Nazar Mein Khwabon Ki Bijliyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.

    Hawa Ke Jhokon Ke Jaise Aazad Rehno Sikho,
    Tum Ek Dariya Ke Jaise Lehron Mein Behna Sikho,
    Har Ek lamhe Se Tum Milo Khole Apni Bhaahein,
    Har Ek Pal Ek Naya Sama Dekhen Yeh Nigahaein,

    Jo Apni Aankhon Mein Hairaniyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.

    Dilon Mein Tum Apni Betaabiyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.

    - Imran ( Zindagi Na Milegi Dobara )

-------------------------------------------------------

	Author :- Gaurang_Kothiya
	Nirma University

*/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> data_set;
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ld long double
#define f(i,x,n) for(auto i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(auto i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()
#define gcd(a,b) __gcd(a,b)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define RE rend()
#define RB rbegin()
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map
#define u_m(a,b) unordered_map
#define mm(a,b) multimap
#define s(a) set
#define us(a) unordered_set
#define ms(a) multiset
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846

bool eq(string s,string t)
{
	if(s.length()%2 !=0 && s.length()>1) return false;

	if(s==t) return true;
	if(s.length()==1)
	{
		if(s!=t) return false;
		else return true;
	}
	int n=s.length();
	string s1=s.substr(0,n/2);
	string s2=s.substr(n/2,n/2);
	string t1=t.substr(0,n/2);
	string t2=t.substr(n/2,n/2);
	return (eq(s1,t1)&&eq(s2,t2))||(eq(s1,t2)&&eq(s2,t1));
}

void Solve()
{
	string a,b;
	cin>>a>>b;
	if(eq(a,b)) cout<<"YES";
	else cout<<"NO";
}

signed main()
{
	speed

	int q=1;
	//cin>>q;

	while(q--)
	Solve();

	//cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
	return 0;
}


/*
------------------------------------------------------

    Dilon Mein Tum Apni Betaabiyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.

    Nazar Mein Khwabon Ki Bijliyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.

    Hawa Ke Jhokon Ke Jaise Aazad Rehno Sikho,
    Tum Ek Dariya Ke Jaise Lehron Mein Behna Sikho,
    Har Ek lamhe Se Tum Milo Khole Apni Bhaahein,
    Har Ek Pal Ek Naya Sama Dekhen Yeh Nigahaein,

    Jo Apni Aankhon Mein Hairaniyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.

    Dilon Mein Tum Apni Betaabiyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.

    - Imran ( Zindagi Na Milegi Dobara )

-------------------------------------------------------

	Author :- Gaurang_Kothiya
	Nirma University

*/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> data_set;
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ld long double
#define f(i,x,n) for(auto i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(auto i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()
#define gcd(a,b) __gcd(a,b)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define RE rend()
#define RB rbegin()
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map
#define u_m(a,b) unordered_map
#define mm(a,b) multimap
#define s(a) set
#define us(a) unordered_set
#define ms(a) multiset
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846

string  small(string s)
{
	if(s.length()%2 ==1) return s;

	string s1= small(s.substr(0,s.length()/2));
	string s2= small(s.substr(s.length()/2,s.length()));
	if(s1+s2<s2+s1) return s1+s2;
	else return s2+s1;
}

void Solve()
{
	string a,b;
	cin>>a>>b;
	string s=small(a);
	string t=small(b);
	if(s==t) cout<<"YES";
	else cout<<"NO";
}

signed main()
{
	speed

	int q=1;
	//cin>>q;

	while(q--)
	Solve();

	//cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eb emplace_back
#define pb push_back
#define mt make_tuple
#define tc  ll t; cin>>t; while(t--)
#define io ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define F first
#define S second
#define vi vector<ll>
#define pii pair<ll,ll>
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define vii vector<pair<ll,ll>>
ll gcd(ll n,ll m)
{
    if(n==0)
            return m;
    return gcd(m%n,n);
}
bool ifprime(ll n)
{
if(n==1)
return false;
	ll i;
for(i=2;i*i<=n;i++)
{
if(n%i==0)
return false;

}
return true;
}
void disp(vi v)
{
    for(auto u:v)
    cout<<u<<" ";
    cout<<"\n";
}
void remleadzero(vector<int> &v)
{
    vector<int> u;
    int i=0;
    while(v[i]==0)
        i++;
    while(i<v.size())
    {
        u.push_back(v[i]);
        i++;
    }
    v=u;
}
#define mod 1000000007
/*
void myscanf(long long *n)
{
    register long long c=getchar_unlocked();
    *n=0;
    for(;(c<48 ||c>57);c=getchar_unlocked())
        ;
    for(;(c>47 && c<58);c=getchar_unlocked())
    {
        *n=(*n<<1)+(*n<<3)+(c&15);
    }

}
void fastscan(long long &number)
{
    bool negative = false;
    register long long c;

    number = 0;

    c = getchar_unlocked();
    if (c=='-')
    {

        negative = true;

        c = getchar_unlocked();
    }

    for (; (c>47 && c<58); c=getchar_unlocked())
        number = number *10 + c - 48;

    if (negative)
        number *= -1;
}
*/

ll fast_expo(ll n,ll m)
{
    ll a=1;
    while(m>0)
    {
        if(m&1) a=(a*n)%mod;
        n=(n*n)%mod;
        m/=2;
    }
    return a%mod;
}

bool eqv(string a,string b)
{
    ll n = a.size();
    if(n&1)
        return a==b;
    n>>=1;
    string b1 = b.substr(0,n);
    string b2 = b.substr(n,n);
    string a1 = a.substr(0,n);
    string a2 = a.substr(n,n);
    return ((eqv(a1,b1) and eqv(a2,b2)) or (eqv(a1,b2) and eqv(a2,b1)));
}

int main()
{
    io;
    string s1,s2;
    cin>>s1>>s2;
    if(eqv(s1,s2)) cout<<"YES";
    else cout<<"NO";
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eb emplace_back
#define pb push_back
#define mt make_tuple
#define tc  ll t; cin>>t; while(t--)
#define io ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define F first
#define S second
#define vi vector<ll>
#define pii pair<ll,ll>
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define vii vector<pair<ll,ll>>
ll gcd(ll n,ll m)
{
    if(n==0)
            return m;
    return gcd(m%n,n);
}
bool ifprime(ll n)
{
if(n==1)
return false;
	ll i;
for(i=2;i*i<=n;i++)
{
if(n%i==0)
return false;

}
return true;
}
void disp(vi v)
{
    for(auto u:v)
    cout<<u<<" ";
    cout<<"\n";
}
void remleadzero(vector<int> &v)
{
    vector<int> u;
    int i=0;
    while(v[i]==0)
        i++;
    while(i<v.size())
    {
        u.push_back(v[i]);
        i++;
    }
    v=u;
}
#define mod 1000000007
/*
void myscanf(long long *n)
{
    register long long c=getchar_unlocked();
    *n=0;
    for(;(c<48 ||c>57);c=getchar_unlocked())
        ;
    for(;(c>47 && c<58);c=getchar_unlocked())
    {
        *n=(*n<<1)+(*n<<3)+(c&15);
    }

}
void fastscan(long long &number)
{
    bool negative = false;
    register long long c;

    number = 0;

    c = getchar_unlocked();
    if (c=='-')
    {

        negative = true;

        c = getchar_unlocked();
    }

    for (; (c>47 && c<58); c=getchar_unlocked())
        number = number *10 + c - 48;

    if (negative)
        number *= -1;
}
*/

ll fast_expo(ll n,ll m)
{
    ll a=1;
    while(m>0)
    {
        if(m&1) a=(a*n)%mod;
        n=(n*n)%mod;
        m/=2;
    }
    return a%mod;
}

bool eqv(string a,string b)
{
    ll n = a.size();
    if(n&1)
        return a==b;
    n/=2;
    string b1 = b.substr(0,n);
    string b2 = b.substr(n,n);
    string a1 = a.substr(0,n);
    string a2 = a.substr(n,n);
    return ((eqv(a1,b1) and eqv(a2,b2)) or (eqv(a1,b2) and eqv(a2,b1)));
}

int main()
{
    io;
    string s1,s2;
    cin>>s1>>s2;
    if(eqv(s1,s2)) cout<<"YES";
    else cout<<"NO";
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eb emplace_back
#define pb push_back
#define mt make_tuple
#define tc  ll t; cin>>t; while(t--)
#define io ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define F first
#define S second
#define vi vector<ll>
#define pii pair<ll,ll>
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define vii vector<pair<ll,ll>>
ll gcd(ll n,ll m)
{
    if(n==0)
            return m;
    return gcd(m%n,n);
}
bool ifprime(ll n)
{
if(n==1)
return false;
	ll i;
for(i=2;i*i<=n;i++)
{
if(n%i==0)
return false;

}
return true;
}
void disp(vi v)
{
    for(auto u:v)
    cout<<u<<" ";
    cout<<"\n";
}
void remleadzero(vector<int> &v)
{
    vector<int> u;
    int i=0;
    while(v[i]==0)
        i++;
    while(i<v.size())
    {
        u.push_back(v[i]);
        i++;
    }
    v=u;
}
#define mod 1000000007
/*
void myscanf(long long *n)
{
    register long long c=getchar_unlocked();
    *n=0;
    for(;(c<48 ||c>57);c=getchar_unlocked())
        ;
    for(;(c>47 && c<58);c=getchar_unlocked())
    {
        *n=(*n<<1)+(*n<<3)+(c&15);
    }

}
void fastscan(long long &number)
{
    bool negative = false;
    register long long c;

    number = 0;

    c = getchar_unlocked();
    if (c=='-')
    {

        negative = true;

        c = getchar_unlocked();
    }

    for (; (c>47 && c<58); c=getchar_unlocked())
        number = number *10 + c - 48;

    if (negative)
        number *= -1;
}
*/

ll fast_expo(ll n,ll m)
{
    ll a=1;
    while(m>0)
    {
        if(m&1) a=(a*n)%mod;
        n=(n*n)%mod;
        m/=2;
    }
    return a%mod;
}

bool eqv(string &a,string &b)
{
    ll n = a.size();
    if(n&1)
        return a==b;
    n>>=1;
    string b1 = b.substr(0,n);
    string b2 = b.substr(n,n);
    string a1 = a.substr(0,n);
    string a2 = a.substr(n,n);
    return ((eqv(a1,b1) and eqv(a2,b2)) or (eqv(a1,b2) and eqv(a2,b1)));
}

int main()
{
    io;
    string s1,s2;
    cin>>s1>>s2;
    if(eqv(s1,s2)) cout<<"YES";
    else cout<<"NO";
}


#include <bits/stdc++.h>
using namespace std;
#include<chrono>
#define ll long long
#define ld long double
#define eb emplace_back
#define pb push_back
#define mt make_tuple
#define tc  ll t; cin>>t; while(t--)
#define io ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define F first
#define S second
#define vi vector<ll>
#define pii pair<ll,ll>
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define vii vector<pair<ll,ll>>
ll gcd(ll n,ll m)
{
    if(n==0)
            return m;
    return gcd(m%n,n);
}
bool ifprime(ll n)
{
if(n==1)
return false;
    ll i;
for(i=2;i*i<=n;i++)
{
if(n%i==0)
return false;

}
return true;
}
void disp(vi v)
{
    for(auto u:v)
    cout<<u<<" ";
    cout<<"\n";
}
void remleadzero(vector<int> &v)
{
    vector<int> u;
    int i=0;
    while(v[i]==0)
        i++;
    while(i<v.size())
    {
        u.push_back(v[i]);
        i++;
    }
    v=u;
}
// #define mod 1000000007LL
/*
void myscanf(long long *n)
{
    register long long c=getchar_unlocked();
    *n=0;
    for(;(c<48 ||c>57);c=getchar_unlocked())
        ;
    for(;(c>47 && c<58);c=getchar_unlocked())
    {
        *n=(*n<<1)+(*n<<3)+(c&15);
    }

}
void fastscan(long long &number)
{
    bool negative = false;
    register long long c;

    number = 0;

    c = getchar_unlocked();
    if (c=='-')
    {

        negative = true;

        c = getchar_unlocked();
    }

    for (; (c>47 && c<58); c=getchar_unlocked())
        number = number *10 + c - 48;

    if (negative)
        number *= -1;
}
*/
ll fast_expo(ll n,ll m, ll md)
{
    ll a=1;
    while(m>0)
    {
        if(m&1) a=(a*n)%md;
        n=(n*n)%md;
        m/=2;
    }
    return a%md;
}
long long sqroot(long long n){
    long double N = n;
    N = sqrtl(N);
    long long sq = N-2;
    sq = max(sq,0LL);
    while(sq*sq<n){
        sq++;
    }
    if((sq*sq)==n)
        return sq;
    return -1;
}
string smallest(string s){
    int a = s.size();
    if(a&1) return s;
    a>>=1;
    string s1 = smallest(s.substr(0,a));
    string s2 = smallest(s.substr(a,a));

    return (s1<s2) ? (s1+s2):(s2+s1);
}
int main()
{
    io;
    string s1,s2;
    cin>>s1>>s2;
    if(smallest(s1)==smallest(s2))
        cout<<"YES";
    else cout<<"NO";
    return 0;

}


#include "bits/stdc++.h"

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define f first
#define s second
#define pb push_back
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define mp(x, y) make_pair(x, y)

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

string A, B;

bool equal(int s, int t, int n)
{
    for (int i = 0; i < n; ++i)
        if (A[s + i] != B[t + i])
            return false;

    return true;
}

bool equivalent(int s, int t, int n)
{
    if (n % 2)
        return equal(s, t, n);

    int h = n / 2;
    if (
        equal(s, t, n) ||
        (equivalent(s, t, h) && equivalent(s + h, t + h, h)) ||
        (equivalent(s, t + h, h) && equivalent(s + h, t, h))
    )
        return true;

    return false;
}

int main()
{ _
    cin >> A >> B;
    int n = A.size();

    if (equivalent(0, 0, n))
        cout << "YES\n";
    else
        cout << "NO\n";
    exit(0);
}


#include "bits/stdc++.h"

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define f first
#define s second
#define pb push_back
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define mp(x, y) make_pair(x, y)

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

string A, B;

bool equivalent(int s, int t, int n)
{
    if (n % 2)
        return A.substr(s, n) == B.substr(t, n);

    int h = n / 2;
    if (
        A.substr(s, n) == B.substr(t, n) ||
        (equivalent(s, t, h) && equivalent(s + h, t + h, h)) ||
        (equivalent(s, t + h, h) && equivalent(s + h, t, h))
    )
        return true;

    return false;
}

int main()
{ _
    cin >> A >> B;
    int n = A.size();

    if (equivalent(0, 0, n))
        cout << "YES\n";
    else
        cout << "NO\n";
    exit(0);
}


#include "bits/stdc++.h"

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define f first
#define s second
#define pb push_back
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define mp(x, y) make_pair(x, y)

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

string A, B;

bool equal(int s, int t, int n)
{
    for (int i = 0; i < n; ++i)
        if (A[s + i] != B[t + i])
            return false;

    return true;
}

bool equivalent(int s, int t, int n)
{
    if (n % 2)
        return equal(s, t, n);

    int h = n / 2;
    if (
        (equivalent(s, t, h) && equivalent(s + h, t + h, h)) ||
        (equivalent(s, t + h, h) && equivalent(s + h, t, h))
    )
        return true;

    return false;
}

int main()
{ _
    cin >> A >> B;
    int n = A.size();

    if (equivalent(0, 0, n))
        cout << "YES\n";
    else
        cout << "NO\n";
    exit(0);
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define nl cout<<"\n"
#define db(x) cout<<x<<" "
#define fi(a,b) for(int i=a;i<b;i++)
#define fj(a,b) for(int j=a;j<b;j++)
#define fk(a,b) for(int k=a;k<b;k++)
#define F first
#define S second
#define mxsize (int)1e6+5
ll fastexp(ll a,ll n,ll nod=LLONG_MAX){
	ll ans=1;
	while(n){
		if(n&1)
			ans=(ans*a)%nod;
		a=(a*a)%nod;
		n>>=1;
	}
	return ans;
}
//shift o is not working
bool check(string& a,string& b){
	int n=a.size();
	if(n==0)	return 0;
	if(a==b)
		return 1;
	if(n%2)	return 0;
	string halfa=a.substr(0,n/2);
	string shalfa=a.substr(n/2);
	string halfb=b.substr(0,n/2);
	string shalfb=b.substr(n/2);
	if(check(halfa,halfb)&&check(shalfa,shalfb))	return 1;
	if(check(halfb,shalfa)&&check(halfa,shalfb))	return 1;
	return 0;
}
bool fun(){
	string a,b;
	cin>>a>>b;
	return check(a,b);
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout.precision(20);
	cout<<fixed;
	#ifndef ONLINE_JUDGE
		freopen("/ATOM/input.txt", "r", stdin);
		freopen("/ATOM/output.txt", "w", stdout);
	#endif
	int t=1;
	// cin>>t;
	while(t--){
		if(fun())	cout<<"YES\n";
		else		cout<<"NO\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define nl cout<<"\n"
#define db(x) cout<<x<<" "
#define fi(a,b) for(int i=a;i<b;i++)
#define fj(a,b) for(int j=a;j<b;j++)
#define fk(a,b) for(int k=a;k<b;k++)
#define F first
#define S second
#define mxsize (int)1e6+5
ll fastexp(ll a,ll n,ll nod=LLONG_MAX){
	ll ans=1;
	while(n){
		if(n&1)
			ans=(ans*a)%nod;
		a=(a*a)%nod;
		n>>=1;
	}
	return ans;
}
//shift o is not working
bool check(string a,string b){
	int n=a.size();
	if(n==0)	return 0;
	if(a==b)
		return 1;
	if(n%2)	return 0;
	string halfa=a.substr(0,n/2);
	string shalfa=a.substr(n/2);
	string halfb=b.substr(0,n/2);
	string shalfb=b.substr(n/2);
	if(check(halfa,halfb)&&check(shalfa,shalfb))	return 1;
	if(check(halfb,shalfa)&&check(halfa,shalfb))	return 1;
	return 0;
}
bool fun(){
	string a,b;
	cin>>a>>b;
	return check(a,b);
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout.precision(20);
	cout<<fixed;
	#ifndef ONLINE_JUDGE
		freopen("/ATOM/input.txt", "r", stdin);
		freopen("/ATOM/output.txt", "w", stdout);
	#endif
	int t=1;
	// cin>>t;
	while(t--){
		if(fun())	cout<<"YES\n";
		else		cout<<"NO\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define nl cout<<"\n"
#define db(x) cout<<x<<" "
#define fi(a,b) for(int i=a;i<b;i++)
#define fj(a,b) for(int j=a;j<b;j++)
#define fk(a,b) for(int k=a;k<b;k++)
#define F first
#define S second
#define mxsize (int)1e6+5
ll fastexp(ll a,ll n,ll nod=LLONG_MAX){
	ll ans=1;
	while(n){
		if(n&1)
			ans=(ans*a)%nod;
		a=(a*a)%nod;
		n>>=1;
	}
	return ans;
}
//shift o is not working
map<pair<string,string>,int> mp;
bool check(string& a,string& b){
	if(mp[{a,b}]){
		if(mp[{a,b}]==-1)	return 0;
		return 1;
	}
	int n=a.size();
	if(n==0){
		mp[{a,b}]=-1;
		return 0;
	}
	if(a==b)
		return mp[{a,b}]=1;
	if(n%2){
		mp[{a,b}]=-1;
		return 0;
	}
	string halfa=a.substr(0,n/2);
	string shalfa=a.substr(n/2);
	string halfb=b.substr(0,n/2);
	string shalfb=b.substr(n/2);
	if(check(halfa,halfb)&&check(shalfa,shalfb))	return mp[{a,b}]=1;
	if(check(halfb,shalfa)&&check(halfa,shalfb))	return mp[{a,b}]=1;
	mp[{a,b}]=-1;
	return 0;
}
bool fun(){
	string a,b;
	cin>>a>>b;
	return check(a,b);
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout.precision(20);
	cout<<fixed;
	#ifndef ONLINE_JUDGE
		freopen("/ATOM/input.txt", "r", stdin);
		freopen("/ATOM/output.txt", "w", stdout);
	#endif
	int t=1;
	// cin>>t;
	while(t--){
		if(fun())	cout<<"YES\n";
		else		cout<<"NO\n";
	}
}


#include<bits/stdc++.h>
#define ll long long
#define N 200005
#define M 1000000007
#define pii pair<int,int>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
ll hs1[N];
ll hs2[N];
ll modd[N];
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;

    return x;
}
void build()
{
    ll p=1;
    for(int i=0;i<N;i++)
    {
        modd[i]=modInverse(p,M);
        p=(p*53)%M;
    }
}
ll hash1(int i,int j)
{
    ll now=hs1[j];
    if(i!=0)
    {
        now-=hs1[i-1];
        now%=M;
        now=(now+M)%M;
        now*=modd[i];
        now%=M;
    }
    return now;
}
ll hash2(int i,int j)
{
    ll now=hs2[j];
    if(i!=0)
    {
        now-=hs2[i-1];
        now%=M;
        now=(now+M)%M;
        now*=modd[i];
        now%=M;
    }
    return now;
}
bool run(int ai,int aj,int bi,int bj)
{
    if(hash1(ai,aj)==hash2(bi,bj))
        return true;
    if((aj-ai+1)%2==0)
    {
        return (run(ai,(ai+aj)/2,bi,(bi+bj)/2)&&run((ai+aj)/2+1,aj,(bi+bj)/2+1,bj))||(run((ai+aj)/2+1,aj,bi,(bi+bj)/2) && run(ai,(ai+aj)/2,(bi+bj)/2+1,bj));
    }
    else
        return false;
}

main()
{
    fast;
    build();
    string a,b;
    cin>>a>>b;
    ll now,p;
    now=0,p=1;
    for(int i=0;i<a.size();i++)
    {
        hs1[i]=(now+a[i]*p)%M;
        p=(p*53)%M;
        now=hs1[i];
    }
    now=0,p=1;
    for(int i=0;i<b.size();i++)
    {
        hs2[i]=(now+b[i]*p)%M;
        p=(p*53)%M;
        now=hs2[i];
    }
    bool ans=run(0,a.size()-1,0,b.size()-1);
    if(ans)
        cout<<"YES";
    else cout<<"NO";
}


#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int N = 200015;
const ll mod = (1e9) + 7;

string s1, s2;
int n;
ll md[]={mod, mod / 10 + 7, mod + 2};
ll f1[N][3], f2[N][3], p[N][3];

int check (int l1, int r1, int l2, int r2){

/*	for (int i = 0 ; i < 1; i++){
		ll cur = p[r1 - l1 +1][i];
		if ( (f1[r1][i] - f1[l1-1][i] * cur % md[i] + md[i]) % md[i]
		!=   (f2[r2][i] - f2[l2-1][i] * cur % md[i] + md[i]) % md[i]) return 0;
	}

	return 1;
*/
	for (int t = 0; l1 + t <= r1 ; t++){
		if (s1[l1+t] != s2[l2+t]) {
			return 0;
		}
	}
	return 1;
}

int sol (int l1, int r1, int l2, int r2){
	int len = r1 - l1 + 1;
	int flag = check(l1, r1, l2, r2);
	if (flag) return 1;
	if (len % 2) {
		return 0;
	}
	return (
		(
			sol( l1, l1 + len/2 - 1, l2 ,l2 + len/2 - 1)
			&&
			sol( l1 + len / 2, r1,  l2 + len /2  , r2 )
		)
		||
		(
			sol( l1, l1 + len/2 - 1, l2 + len /2  , r2)
			&&
			sol( l1 + len / 2, r1,  l2 ,l2 + len/2 - 1)
		)
	);

}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	cin >> s1 >> s2;

	n = s1.size();

	for (int i = 1 ; i <= n; i++){
		ll x = s1[i-1] - 'a';
		for (int j = 0; j < 1; j++)
		f1[i][j] = ( f1[i-1][j] * 26 % md[j] + x ) % md[j];
		ll y = s2[i-1] - 'a';
		for (int j = 0; j < 1; j++)
		f2[i][j] = ( f2[i-1][j] * 26 % md[j] + y ) % md[j];
	}

	for (int i = 0; i < 3; i++) p[0][0] = 1;

	for (int i = 1; i <=n; i++) {
		for (int j = 0; j < 3; j++)
		p[i][j] = p[i-1][j] * 26 % md[j];
	}

	if (sol(1, n, 1, n)) cout << "YES"; else cout << "NO";

}


#include <iostream>
#include <vector>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;

struct planet {
    int x, y ,z;
};
struct two_po
{
    double z,y;
};
struct three_po
{
    double z,y,x;
};
vector<planet> mass;
double len_m(double x , double y, double z)
{
    double max=-1;
    for(int i = 0 ; i < mass.size();i++)
    {
        double len=pow(mass[i].x-x,2.0)+pow(mass[i].y-y,2.0)+pow(mass[i].z-z,2.0);
        if (len>max)
            max=len;
    }
    return max;
}

double serc_z(double x, double y)
{
    double r=10000,l=-10000;

    while(r-l>10e-9)
    {

        double m1=l+(r-l)/3.0;
        double m2=r-(r-l)/3.0;
        double Lm1=len_m(x,y,m1);
        double Lm2=len_m(x,y,m2);
        if (Lm1<Lm2)
            r=m2;
        if (Lm1>Lm2)
            l=m1;
        if (Lm1==Lm2)
        {
            l=m1;
            r=m2;
        }
    }
return r;
}
two_po serc_y(double x)
{
    double z_m1;
    double z_m2;
    double r=10000,l=-10000;

    while(r-l>10e-9)
    {
        double m1=l+(r-l)/3.0;
        double m2=r-(r-l)/3.0;
        z_m1=serc_z(x,m1);
        z_m2=serc_z(x,m2);
        double Lm1=len_m(x,m1,z_m1);
        double Lm2=len_m(x,m2,z_m2);
        if (Lm1<Lm2)
            r=m2;
        if (Lm1>Lm2)
            l=m1;
        if (Lm1==Lm2)
        {
            l=m1;
            r=m2;
        }
    }
    two_po ans;

        ans.y=r;
        ans.z=serc_z(x,r);

return ans;
}
three_po all_ser()
{
    three_po ans;
    two_po tw_m1;
    two_po tw_m2;
    double r=10000,l=-10000;
    while(r-l>10e-9)
    {
        double m1=l+(r-l)/3.0;
        double m2=r-(r-l)/3.0;
        tw_m1=serc_y(m1), tw_m2=serc_y(m2);
        double Lm1 = len_m(m1,tw_m1.y,tw_m1.z);
        double Lm2 = len_m(m2,tw_m2.y,tw_m2.z);
        if (Lm1<Lm2)
            r=m2;
        if (Lm1>Lm2)
            l=m1;
        if (Lm1==Lm2)
        {
            l=m1;
            r=m2;
        }
    }

        ans.x=r;
        tw_m1=serc_y(r);
        ans.y=tw_m1.y;
        ans.z=tw_m1.z;

    return ans;
}
int main() {

    int n ;
    cin >> n;
    for (int i = 0 ;i < n ; i ++){
        planet temp;
        cin >> temp.x >> temp.y >> temp.z;
        mass.push_back(temp);
    }
    three_po ans = all_ser();

    cout << fixed << setprecision(6)<< ans.x << " " << ans.y << " " << ans.z;
    return 0;
}


import java.util.Scanner;
public class Bitplusplus
{
    public static void main(String [] args){
        int x=0;

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n<=1 && n<=150)
        {
        for(int i=1; i<=n;i++)
        {
            String opearation = sc.next();
            if (operartion.charAt(0)=='X')
            {
                if (operation.charAt(1)=='+')
            {
                x++;
            }
            if (operation.charAt(1)=='-')
            {
                x--;
            }
            }
            else if (operation.charAt(1)=='+')
            {
                ++x;
            }
            else
            {
                --x;
            }

        }
         System.out.println(x);
    }
}
}


public class  Bitplusplus
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
         x = 0;
         n = sc.nextInt();
         if(n<=1 && n<=150){
         for(int i=1;i<=n;i++){

              String operation = sc.next();

              if(operation.charAt(0)=='X')
              {
               if(operation.charAt(1)=='+')
              {
                  x++;
              }
              if(operation.charAt(1)=='-')
             {
                 x--;
             }
         }
        else if(operation.charAt(1)=='+')
        {
            ++x;
        }
        else
        {
            --x;
        }
    }
}
      System.out.println(x);
}
}


import java.util.Scanner;
public class Bitplusplus
{
    public static void main(String [] args){
        int x=0;

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n>=1 && n<=150)
        {
        for(int i=1; i<=n;i++)
        {
            String opearation = sc.next();
            if (operartion.charAt(0)=='X')
            {
                if (operation.charAt(1)=='+')
            {
                x++;
            }
            if (operation.charAt(1)=='-')
            {
                x--;
            }
            }
            else if (operation.charAt(1)=='+')
            {
                ++x;
            }
            else
            {
                --x;
            }

        }
         System.out.println(x);
    }
}
}


public class  Bitplusplus
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
         x = 0;
         n = sc.nextInt();
         if(n<=1 && n<=150){
         for(int i=1;i<=n;i++){

              String operation = sc.next();

              if(operation.charAt(0)=='X')
              {
               if(operation.charAt(1)=='+')
              {
                  x++;
              }
              if(operation.charAt(1)=='-')
             {
                 x--;
             }
         }
        else if(operation.charAt(1)=='+')
        {
            ++x;
        }
        else(opeartion.charAt(1)=='-')
        {
            --x;
        }
    }
}
      System.out.println(x);
}
}


import java.util.Scanner;
public class Bitplusplus
{
    public static void main(String [] args){
        int x=0;

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n>=1 && n<=150)
        {
        for(int i=1; i<=n;i++)
        {
            String opearation = sc.next();
            if(operartion.charAt(0)=='X')
            {
                if(operation.charAt(1)=='+')
            {
                x++;
            }
            }
            else if(operation.charAt(1)=='+')
            {
                ++x;
            }
            else
            {
                --x;
            }

            System.out.println(x);

        }
    }
}
}
}


import java.util.Scanner;
public class Bitplusplus
{
    public static void main(String [] args){
        int x=0;

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n>=1 && n<=150)
        {
        for(int i=1; i<=n;i++)
        {
            String opearation = sc.next();
            if(operartion.charAt(0)=='X')
            {
                if(operation.charAt(1)=='+')
            {
                x++
            }
            }
            else if(operation.charAt(1)=='+')
            {
                ++x;
            }
            else
            {
                --x;
            }

            System.out.println(x);

        }
    }
}
}
}


import java.util.Scanner;
public class Bitplusplus
{
    public static void main(String [] args){
        int x=0;

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n>=1 && n<=150)
        {
        for(int i=1; i<=n;i++)
        {
            String opearation = sc.next();
            if(operartion.charAt(0)=='X')
            {
                if(operation.charAt(1)=='+')
            {
                x++;
            }
            }
            else if(operation.charAt(1)=='+')
            {
                ++x;
            }
            else
            {
                --x;
            }

        }
         System.out.println(x);
    }
}
}


import java.util.Scanner;
public class 282A{
    public static void main(String [] args){

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        System.out.println(n++);

    }


import java.util.Scanner;
public class Bitplusplus{
    public static void main(String args []){
        int x = 0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n<=1 && n<=150){
        for(int i=1;i<n;i++)
        {

        String operation = sc.nextLine();
        if(operation.chartAt(0)=='X')
        if(operaton.charAt(1)=='+')
        {
            x++;

        }
        if(operation.charAt(1)=='-'){
        x--;
        }
        else if(operation.charAt(0)=='+')
        {
            ++x;

        }
        else
        {
           --x;
        }

    }
    System.out.println(x);
}
}
}


import java.util.Scanner;
public class Problem282A{
    public static void main(String args []){
        int x = 0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while (n--<=1){

        String operation = sc.nextLine();
        if(operation.chartAt(0)=='X')
        if(operaton.charAt(1)=='+')
        {
            x++;

        }
        if(operation.charAt(1)=='-'){
        x--;
        }
        else if(operation.charAt(0)=='+')
        {
            ++x;

        }
        else
        {
           --x;
        }

    }
    System.out.println(x);

}
}


import java.util.Scanner;
public class Bitplusplus
{
    public static void main(String [] args){
        int x=0;

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n>=1 && n<=150)
        {
        for(int i=1; i<=n;i++)
        {
            String opearation = sc.next();
            if (operartion.charAt(0)=='X')
            {
                if (operation.charAt(1)=='+')
            {
                x++;
            }
            }
            else if (operation.charAt(1)=='+')
            {
                ++x;
            }
            else
            {
                --x;
            }

        }
         System.out.println(x);
    }
}
}


import java.util.Scanner;
public class  Bitplusplus
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
         x = 0;
         n = sc.nextInt();
         if(n<=1 && n<=150){
         for(int i=1;i<=n;i++){

              String operation = sc.next();

              if(operation.charAt(0)=='X')
              {
               if(operation.charAt(1)=='+')
              {
                  x++;
              }
              if(operation.charAt(1)=='-')
             {
                 x--;
             }
         }
        else if(operation.charAt(1)=='+')
        {
            ++x;
        }
        else
        {
            --x;
        }
    }

}
     System.out.println(x);
}
}


import java.util.Scanner;
public class Bitplusplus{
    public static void main(String args []){
        int x = 0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n<=1 && n<=150){
        for(i=1;i<n;i++)
        {

        String operation = sc.nextLine();
        if(operation.chartAt(0)=='X')
        if(operaton.charAt(1)=='+')
        {
            x++;

        }
        if(operation.charAt(1)=='-'){
        x--;
        }
        else if(operation.charAt(0)=='+')
        {
            ++x;

        }
        else
        {
           --x;
        }

    }
    System.out.println(x);
}
}
}


import java.util.Scanner;
public class  Bitplusplus
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
         int x = 0;
         int n = sc.nextInt();
         if(n<=1 && n<=150){
         for(int i=1;i<=n;i++){

              String operation = sc.next();

              if(operation.charAt(0)=='X')
              {
               if(operation.charAt(1)=='+')
              {
                  x++;
              }
              if(operation.charAt(1)=='-')
             {
                 x--;
             }
         }
        else if(operation.charAt(1)=='+')
        {
            ++x;
        }
        else
        {
            --x;
        }
    }

}
     System.out.println(x);
}
}


import java.util.*;
import java.util.Arrays;
public class solution{
    // public static void QuickSort(int[] array, int left, int right){
    //     if (array.length == 0){
    //         return;  // special case - arraydyn uzyndygy 0 ge ten bolsa zhai gana toktata salamyz
    //     }
    //     int middle = left + (right - left) / 2;  // pivot elementty tauyp alamyz
    //     int pivot = array[middle];
    //     int i = left;
    //     int j = right;        // subarraylarga bolemiz left zhagy pivottan kiwi, right zhagy pivottan ulken
    //     while(i <= j){
    //         while(array[i] < pivot){
    //             i++;
    //         }
    //         while(array[j] > pivot){
    //             j--;
    //         }
    //         if(i <= j) {
    //             int temp = array[i];      // condition koldanu arkyly elementterdyn oryndaryn auystyramyz (swap)
    //             array[i] = array[j];
    //             array[j] = temp;
    //             i++;
    //             j--;
    //         }
    // }
    //     if(left < j){
    //       QuickSort(array, left, j); // zhalpy quicksort rekursia arkyly zhuredi condition arkyly rekursia shakyramyz sodan son sorttaimyz
    //     }
    //     if(right > i){
    //       QuickSort(array, i, right);
    //     }
    // }
    // public static void main(String[] args) {
    //     int[] arr = {2, 1, 5, 4, 3};
    //     System.out.print("Array before sorting: ");
    //     for(int i = 0; i < arr.length; i++){
    //     System.out.print(arr[i] + " ");
    //     }
    //     System.out.println();
    //     int left = 0;
    //     int right = arr.length - 1;
    //     QuickSort(arr, left, right);
    //     System.out.print("Array after sorting: ");
    //     for(int i = 0; i < arr.length; i++){
    //     System.out.print(arr[i] + " ");
    //     }
    public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
      int number = in.nextInt(); // 1
      int x = 0;
      String[] str = new String[number];
      for(int i = 0; i < number; i++){
    //   String b = in.next();
        str[i] = in.next(); // X++
      }
      for(int i = 0; i < number; i++){
        if(str[i].equals("++X") || str[i].equals("X++")){
        x++;
        }else{
        x--;
        }
          }
          System.out.println(x);

    }
}


import java.util.*;
import java.util.Arrays;
public class solution{
    // public static void QuickSort(int[] array, int left, int right){
    //     if (array.length == 0){
    //         return;  // special case - arraydyn uzyndygy 0 ge ten bolsa zhai gana toktata salamyz
    //     }
    //     int middle = left + (right - left) / 2;  // pivot elementty tauyp alamyz
    //     int pivot = array[middle];
    //     int i = left;
    //     int j = right;        // subarraylarga bolemiz left zhagy pivottan kiwi, right zhagy pivottan ulken
    //     while(i <= j){
    //         while(array[i] < pivot){
    //             i++;
    //         }
    //         while(array[j] > pivot){
    //             j--;
    //         }
    //         if(i <= j) {
    //             int temp = array[i];      // condition koldanu arkyly elementterdyn oryndaryn auystyramyz (swap)
    //             array[i] = array[j];
    //             array[j] = temp;
    //             i++;
    //             j--;
    //         }
    // }
    //     if(left < j){
    //       QuickSort(array, left, j); // zhalpy quicksort rekursia arkyly zhuredi condition arkyly rekursia shakyramyz sodan son sorttaimyz
    //     }
    //     if(right > i){
    //       QuickSort(array, i, right);
    //     }
    // }
    // public static void main(String[] args) {
    //     int[] arr = {2, 1, 5, 4, 3};
    //     System.out.print("Array before sorting: ");
    //     for(int i = 0; i < arr.length; i++){
    //     System.out.print(arr[i] + " ");
    //     }
    //     System.out.println();
    //     int left = 0;
    //     int right = arr.length - 1;
    //     QuickSort(arr, left, right);
    //     System.out.print("Array after sorting: ");
    //     for(int i = 0; i < arr.length; i++){
    //     System.out.print(arr[i] + " ");
    //     }
    public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
      int number = in.nextInt(); // 1
      String s = "";
      for(int i = 0; i <= number; i++){
      s = in.nextLine(); // X++
      }
      int x = 0;
      int x2 = 0;
      int x3 = 0;
          if((s.equals("++X") || s.equals("X++")) && number > 1){
                           x++;
            if(s.equals("--X") || s.equals("X--")){
                x2--;
                System.out.println(x + x2);
           }
          if(s.equals("X++") || s.equals("++X")){
            x2++;
            System.out.println(x + x2);
          }
          }
          if((s.equals("X++") || s.equals("++X")) && number == 1){
            x3++;
            System.out.println(x3);
          }
          if((s.equals("X--") || s.equals("--X")) && number == 1){
          x3--;
          System.out.println(x3);
          }

    }
}


import java.util.*;
import java.util.Arrays;
public class solution{
    // public static void QuickSort(int[] array, int left, int right){
    //     if (array.length == 0){
    //         return;  // special case - arraydyn uzyndygy 0 ge ten bolsa zhai gana toktata salamyz
    //     }
    //     int middle = left + (right - left) / 2;  // pivot elementty tauyp alamyz
    //     int pivot = array[middle];
    //     int i = left;
    //     int j = right;        // subarraylarga bolemiz left zhagy pivottan kiwi, right zhagy pivottan ulken
    //     while(i <= j){
    //         while(array[i] < pivot){
    //             i++;
    //         }
    //         while(array[j] > pivot){
    //             j--;
    //         }
    //         if(i <= j) {
    //             int temp = array[i];      // condition koldanu arkyly elementterdyn oryndaryn auystyramyz (swap)
    //             array[i] = array[j];
    //             array[j] = temp;
    //             i++;
    //             j--;
    //         }
    // }
    //     if(left < j){
    //       QuickSort(array, left, j); // zhalpy quicksort rekursia arkyly zhuredi condition arkyly rekursia shakyramyz sodan son sorttaimyz
    //     }
    //     if(right > i){
    //       QuickSort(array, i, right);
    //     }
    // }
    // public static void main(String[] args) {
    //     int[] arr = {2, 1, 5, 4, 3};
    //     System.out.print("Array before sorting: ");
    //     for(int i = 0; i < arr.length; i++){
    //     System.out.print(arr[i] + " ");
    //     }
    //     System.out.println();
    //     int left = 0;
    //     int right = arr.length - 1;
    //     QuickSort(arr, left, right);
    //     System.out.print("Array after sorting: ");
    //     for(int i = 0; i < arr.length; i++){
    //     System.out.print(arr[i] + " ");
    //     }
    public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
      int number = in.nextInt(); // 1
      String s = "";
      for(int i = 0; i <= number; i++){
      s = in.nextLine(); // X++
      }
      int x = 0;
      int x2 = 0;
      int x3 = 0;
          if(s.equals("++X") || s.equals("X++") && number > 1){
                           x++;
            if(s.equals("--X") || s.equals("X--")){
                            x2--;
           }
           System.out.println(x + x2);
          }
          if(s.equals("X++") || s.equals("++X") && number == 1){
            x3++;
            System.out.println(x3);
          }
          if(s.equals("X--") || s.equals("--X") && number == 1){
          x3--;
          System.out.println(x3);
          }

    }
}


import java.util.*;
import java.util.Arrays;
public class solution{
    // public static void QuickSort(int[] array, int left, int right){
    //     if (array.length == 0){
    //         return;  // special case - arraydyn uzyndygy 0 ge ten bolsa zhai gana toktata salamyz
    //     }
    //     int middle = left + (right - left) / 2;  // pivot elementty tauyp alamyz
    //     int pivot = array[middle];
    //     int i = left;
    //     int j = right;        // subarraylarga bolemiz left zhagy pivottan kiwi, right zhagy pivottan ulken
    //     while(i <= j){
    //         while(array[i] < pivot){
    //             i++;
    //         }
    //         while(array[j] > pivot){
    //             j--;
    //         }
    //         if(i <= j) {
    //             int temp = array[i];      // condition koldanu arkyly elementterdyn oryndaryn auystyramyz (swap)
    //             array[i] = array[j];
    //             array[j] = temp;
    //             i++;
    //             j--;
    //         }
    // }
    //     if(left < j){
    //       QuickSort(array, left, j); // zhalpy quicksort rekursia arkyly zhuredi condition arkyly rekursia shakyramyz sodan son sorttaimyz
    //     }
    //     if(right > i){
    //       QuickSort(array, i, right);
    //     }
    // }
    // public static void main(String[] args) {
    //     int[] arr = {2, 1, 5, 4, 3};
    //     System.out.print("Array before sorting: ");
    //     for(int i = 0; i < arr.length; i++){
    //     System.out.print(arr[i] + " ");
    //     }
    //     System.out.println();
    //     int left = 0;
    //     int right = arr.length - 1;
    //     QuickSort(arr, left, right);
    //     System.out.print("Array after sorting: ");
    //     for(int i = 0; i < arr.length; i++){
    //     System.out.print(arr[i] + " ");
    //     }
    public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
      int number = in.nextInt(); // 1
      String s = "";
      for(int i = 0; i <= number; i++){
      s = in.nextLine(); // X++
      }
      int x = 0;
      int x2 = 0;
      int x3 = 0;
          if((s.equals("++X") || s.equals("X++")) && number > 1){
                           x++;
            if(s.equals("--X") || s.equals("X--")){
                            x2--;
           }
           System.out.println(x + x2);
          }
          if((s.equals("X++") || s.equals("++X")) && number == 1){
            x3++;
            System.out.println(x3);
          }
        //   if((s.equals("X--") || s.equals("--X")) && number == 1){
        //   x3--;
        //   System.out.println(x3);
        //   }

    }
}


import java.util.*;
import java.util.Arrays;
public class solution{
    // public static void QuickSort(int[] array, int left, int right){
    //     if (array.length == 0){
    //         return;  // special case - arraydyn uzyndygy 0 ge ten bolsa zhai gana toktata salamyz
    //     }
    //     int middle = left + (right - left) / 2;  // pivot elementty tauyp alamyz
    //     int pivot = array[middle];
    //     int i = left;
    //     int j = right;        // subarraylarga bolemiz left zhagy pivottan kiwi, right zhagy pivottan ulken
    //     while(i <= j){
    //         while(array[i] < pivot){
    //             i++;
    //         }
    //         while(array[j] > pivot){
    //             j--;
    //         }
    //         if(i <= j) {
    //             int temp = array[i];      // condition koldanu arkyly elementterdyn oryndaryn auystyramyz (swap)
    //             array[i] = array[j];
    //             array[j] = temp;
    //             i++;
    //             j--;
    //         }
    // }
    //     if(left < j){
    //       QuickSort(array, left, j); // zhalpy quicksort rekursia arkyly zhuredi condition arkyly rekursia shakyramyz sodan son sorttaimyz
    //     }
    //     if(right > i){
    //       QuickSort(array, i, right);
    //     }
    // }
    // public static void main(String[] args) {
    //     int[] arr = {2, 1, 5, 4, 3};
    //     System.out.print("Array before sorting: ");
    //     for(int i = 0; i < arr.length; i++){
    //     System.out.print(arr[i] + " ");
    //     }
    //     System.out.println();
    //     int left = 0;
    //     int right = arr.length - 1;
    //     QuickSort(arr, left, right);
    //     System.out.print("Array after sorting: ");
    //     for(int i = 0; i < arr.length; i++){
    //     System.out.print(arr[i] + " ");
    //     }
    public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
      int number = in.nextInt(); // 1
      String s = "";
      for(int i = 0; i <= number; i++){
      s = in.nextLine(); // X++
      }
      int x = 0;
      int x2 = 0;
      int x3 = 0;
          if((s.equals("++X") || s.equals("X++")) && number > 1){
                           x++;
            if(s.equals("--X") || s.equals("X--")){
                            x2--;
           }
           System.out.println(x + x2);
          }
          if((s.equals("X++") || s.equals("++X")) && number == 1){
            x3++;
            System.out.println(x3);
          }
          if((s.equals("X--") || s.equals("--X")) && number == 1){
          x3--;
          System.out.println(x3);
          }

    }
}


import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    scan.nextLine();
    int x = 0;
    for (int i = 0; i < n; i++) {
        x += scan.nextLine().charAt(1) == '+' ? -1 : 1;
    }
  }
}


import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int x = 0;
    for (int i = 0; i < n; i++) {
        x += scan.next().charAt(1) == '+' ? 1 : -1;
    }
    System.out.println(x);
  }
}


import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    scan.nextLine();
    int x = 0;
    for (int i = 0; i < n; i++) {
        x += scan.nextLine().charAt(1) == '+' ? 1 : -1;
    }
    System.out.println(x);
  }
}


import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int x = 0;
    for (int i = 0; i < n; i++) {
        if (scan.next().charAt(1) == '+') {
            x++;
        }
        else {
            x--;
        }
    }
    System.out.println(x);
  }
}


import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
  Scanner scan = new Scanner(System.in);
  int x = 0;
  int a = scan.nextInt();
  for(int i = 0; i < a; i++){
   String s = scan.next();
   if (s.indexOf("++") >= 0 && s.indexOf("X") >= 0){
    x++;
   }
   else{
    x--;
   }
  }
  System.out.println(x);
 }
}


import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    scan.nextLine();
    int x = 0;
    for (int i = 0; i < n; i++) {
        x += scan.nextLine().charAt(1) == '+' ? -1 : 1;
    }
    System.out.println(x);
  }
}


import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int x = 0;
    for (int i = 0; i < n; i++) {
        if (scan.next().indexOf('+') >= 0) {
            x++;
        }
        else {
            x--;
        }
    }
    System.out.println(x);
  }
}


import java.util.*;

public class bite{
    public static void main (String []args){
        Scanner in=new Scanner (System.in);

        int n=in.nextInt();
        int X=0;
        String operation=in.nextLine();

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

            for (int j=0; j<operation.length(); j++){
                for (int k = j + 1; k < operation.length(); k++) {
					if (operation.charAt(j) == '+') {
						if (operation.charAt(k) == '+') {
							X++;
						}
						else {
							break;
						}
					}
					if (operation.charAt(j) == '-') {
						if (operation.charAt(k) == '-') {
							X--;
						}
						else {
							break;
						}
					}
				}
			}
		}

		System.out.println (X);
	}
}


import java.util.*;

public class bite++{
    public static void main (String []args){
        Scanner in=new Scanner (System.in);

        int n=in.nextInt();
        int X=0;
        String operation=in.nextLine();

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

            for (j=0; j<operation.length(); j++){
                for (int k = j + 1; k < operation.length(); k++) {
					if (operation.charAt(j) == '+') {
						if (operation.charAt(k) == '+') {
							X++;
						}
						else {
							break;
						}
					}
					if (operation.charAt(j) == '-') {
						if (operation.charAt(k) == '-') {
							X--;
						}
						else {
							break;
						}
					}
				}
			}
		}

		System.out.println (X);
	}
}


import java.util.*;

public class bite{
    public static void main (String []args){
        Scanner in=new Scanner (System.in);

        int n=in.nextInt();
        int X=0;
        String operation;

        for(int i=0; i<n+1; i++){
            operation=in.nextLine();
            for (int j=0; j<operation.length(); j++){
                for (int k = j + 1; k < operation.length(); k++) {
					if (operation.charAt(j) == '+') {
						if (operation.charAt(k) == '+') {
							X++;
						}
						else {
							break;
						}
					}
					if (operation.charAt(j) == '-') {
						if (operation.charAt(k) == '-') {
							X--;
						}
						else {
							break;
						}
					}
				}
			}
		}

		System.out.println (X);
	}
}


import java.util.*;

public class bite++{
    public static void main (String []args){
        Scanner in=new Scanner (System.in);

        int n=in.nextInt();
        int X=0;

        for(int i=1; i<=n; i++){
            String operation=in.nextLine();
            for (j=0; j<operation.length(); j++){
                for (int k = j + 1; k < operation.length(); k++) {
					if (operation.charAt(j) == '+') {
						if (operation.charAt(k) == '+') {
							X++;
						}
						else {
							break;
						}
					}
					if (operation.charAt(j) == '-') {
						if (operation.charAt(k) == '-') {
							X--;
						}
						else {
							break;
						}
					}
				}
			}
		}

		System.out.println (X);
	}
}


import java.util.*;

public class bite{
    public static void main (String []args){
        Scanner in=new Scanner (System.in);

        int n=in.nextInt();
        int X=0;
        String operation;

        for(int i=0; i<n; i++){
            operation=in.nextLine();
            for (int j=0; j<operation.length(); j++){
                for (int k = j + 1; k < operation.length(); k++) {
					if (operation.charAt(j) == '+') {
						if (operation.charAt(k) == '+') {
							X++;
						}
						else {
							break;
						}
					}
					if (operation.charAt(j) == '-') {
						if (operation.charAt(k) == '-') {
							X--;
						}
						else {
							break;
						}
					}
				}
			}
		}

		System.out.println (X);
	}
}


import java.util.*;

public class bite{
    public static void main (String []args){
        Scanner in=new Scanner (System.in);

        int n=in.nextInt();
        int X=0;

        for(int i=1; i<=n; i++){
            String operation=in.nextLine();
            for (int j=0; j<operation.length(); j++){
                for (int k = j + 1; k < operation.length(); k++) {
					if (operation.charAt(j) == '+') {
						if (operation.charAt(k) == '+') {
							X++;
						}
						else {
							break;
						}
					}
					if (operation.charAt(j) == '-') {
						if (operation.charAt(k) == '-') {
							X--;
						}
						else {
							break;
						}
					}
				}
			}
		}

		System.out.println (X);
	}
}


import java.util.*;

public class bite{
    public static void main (String []args){
        Scanner in=new Scanner (System.in);

        int n=in.nextInt();
        int X=0;

        for(int i=1; i<=n; i++){
            String operation=in.nextLine();
            for (j=0; j<operation.length(); j++){
                for (int k = j + 1; k < operation.length(); k++) {
					if (operation.charAt(j) == '+') {
						if (operation.charAt(k) == '+') {
							X++;
						}
						else {
							break;
						}
					}
					if (operation.charAt(j) == '-') {
						if (operation.charAt(k) == '-') {
							X--;
						}
						else {
							break;
						}
					}
				}
			}
		}

		System.out.println (X);
	}
}


import java.util.*;
public class Test
{
    public static void main(String[] args)
    {
        int c=0;
        Scanner sc=new Scanner(system.in);
        int t=sc.nextInt();
        //sc.nextLine();
        while(t-->0)
        {
         String s=sc.nextLine();
         if(s=="++X"||s=="X++")
         c++;
         else
         c--;
        }
        System.out.println(c);}
}


import java.util.*;
public class Test
{
    public static void main(String[] args)
    {
        int c=0;
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        sc.nextLine();
        while(t-->0)
        {
         String s=sc.nextLine();
         if(s=="++X"||s=="X++")
         c++:
         else
         c--;
        }
        System.out.println(c);}
}


import java.util.*;
public class Test
{
    public static void main(String[] args)
    {
        int c=0;
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
      //  sc.nextLine();
        while(t-->0)
        {
         String s=sc.nextLine();
         if(s=="++X"||s=="X++")
         c++;
         else
         c--;
        }
        System.out.println(c);}
}


import java.util.*;
public class Test
{
    public static void main(String[] args)
    {
        int c=0;
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        sc.nextLine();
        while(t-->0)
        {
         String s=sc.nextLine();
         if(s=="++X"||s=="X++")
         c++;
         else
         c--;
        }
        System.out.println(c);}
}


import java.util.*;
public class Test
{
    public static void main(String[] args)
    {
        int c=0;
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
       sc.nextLine();
        while(t-->0)
        {
         String s=sc.nextLine();
         if(s.charAt(1)=='+')
         c++;
         else
         c--;
        }
        System.out.println(c);}
}


import java.util.*;
public class Test
{
    public static void main(String[] args)
    {
        int c=0;
        Scanner sc=new Scanner(system.in);
        int t=sc.nextInt();
        sc.nextLine();
        while(t-->0)
        {
         String s=sc.nextLine();
         if(s=="++X"||s=="X++")
         c++;
         else
         c--;
        }
        System.out.println(c);}
}


import java.util.*;
public class Test
{
    public static void main(String[] args)
    {
        int c=0;
        Scanner sc=new Scanner(system.in);
        int t=sc.nextInt();
        sc.nextLine();
        while(t-->0)
        {
         String s=sc.nextLine();
         if(s=="++X"||s=="X++")
         c++;
         else
         c--;
        }
        System.out.println(c);
    }
}


import java.util.*;
public class Test
{
    public static void main(String[] args)
    {
        int c=0;
        Scanner sc=new Scanner(system.in);
        int t=sc.nextInt();
        sc.nextLine();
        while(t-->0)
        {
         String s=sc.nextLine();
         if(s=="++X"||s=="X++")
         c++;
         else
         c--; }
        System.out.println(c);}
}


import java.util.*;
public class Test
{
    public static void main(String[] args)
    {
        int c=0;
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        sc.nextLine();
        while(t-->0)
        {
         String s=sc.nextLine();
         if(s=="++X"||s=="X++")
         c++:
         else
         c--;
        }
        System.out.println(c);
    }
}


import java.util.*;
public class Test
{
    public static void main(String[] args)
    {
        int c=0;
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
      //  sc.nextLine();
        while(t-->0)
        {
         String s=sc.nextLine();
         if(s.charAt(1)=='+')
         c++;
         else
         c--;
        }
        System.out.println(c);}
}


import java.util.*;
public class Test
{
    public static void main(String[] args)
    {
        int c=0;
        Scanner sc=new Scanner(system.in);
        int t=sc.nextInt();
        sc.nextLine();
        while(t-->0)
        {
         String s=sc.nextLine();
         if(s=="++X"||s=="X++")
         c++:
         else
         c--;
        }
        System.out.println(c);
    }
}


import java.util.Scanner;

public class main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int x = 0;
        scan.nextLine();
        String s;
        for(int i = 0; i < n; i++) {
            s = scan.nextLine();
            if(s.indexOf("+") < 0) x--;
            else x++;
        }
        System.out.print(x);
    }
}


import java.util.Scanner;

public class main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        byte n = scan.nextByte();
        int x = 0;
        String s;
        for(int i = 0; i < n; i++) {
            s = scan.nextLine();
            if(s.indexOf("+") < 0) x--;
            else x++;
        }
        System.out.print(x);
    }
}


import java.util.Scanner;

public class main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextByte();
        int x = 0;
        scan.nextLine();
        String s;
        for(int i = 0; i < n; i++) {
            s = scan.nextLine();
            if(s.indexOf("+") < 0) x--;
            else x++;
        }
        System.out.print(x);
    }
}


import java.util.Scanner;

public class main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        byte n = scan.nextByte();
        int x = 0;
        String s;
        for(int i = 0; i < n; i++) {
            s = scan.next();
            if(s.indexOf("+") < 0) x--;
            else x++;
        }
        System.out.print(x);
    }
}


import java.util.Scanner;

public class main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        byte n = scan.nextByte();
        int x = 0;
        scan.nextLine();
        String s;
        for(int i = 0; i < n; i++) {
            s = scan.nextLine();
            if(s.indexOf("+") < 0) x--;
            else x++;
        }
        System.out.print(x);
    }
}


import java.util.Scanner;

public class main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int x = 0;
        //scan.nextLine();
        String s;
        for(int i = 0; i < n; i++) {
            s = scan.nextLine();
            if(s.indexOf("+") < 0) x--;
            else x++;
        }
        System.out.print(x);
    }
}


import java.io.*;
import java.util.*;
public class Bit
{

    public static void main(String args[]) throws IOException
    {
         int n,i,x=0;
         String s;
        InputStreamReader isr = new  InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        n=Integer.parseInt(br.readLine());
        for (i=0;i<n;i++)
        {
        s=br.readLine();
        switch(s)
        {
            case "x++":x++;break;
            case "x--":x--;break;
            case "++x":++x;break;
            case "--x":--x;break;
            default: break;

        }
        }
        System.out.println(x);
    }
}


import java.io.*;
import java.util.*;
public class Bit
{

    public static void main(String args[]) throws IOException
    {
         int n,i;
         String s;
        InputStreamReader isr = new  InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        n=Integer.parseInt(br.readLine());
        for (i=0;i<n;i++)
        {
        s=br.readLine();
        switch(s)
        {
            case "x++":n++;break;
            case "x--":n--;break;
            case "++x":++n;break;
            case "--x":--n;break;
            default: break;

        }
        }
    }
}


import java.io.*;
import java.util.regex;
public class Bit
{
    int n,i;
    String s;
    public static void main(String args[]) throws IOException
    {
        InputStreamReader isr = new  InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        n=Integer.parseInt(br.readLine());
        for (i=0;i<n;i++)
        {
        s=br.readLine();
        switch(s)
        {
            case "x++":n++;break;
            case "x--":n--;break;
            case "++x":++n;break;
            case "--x":--n;break;
            default: break;

        }
        }
    }
}


import java.io.*;
import java.util.*;
public class Bit
{

    public static void main(String args[]) throws IOException
    {
         int n,i,x=0;
         String s;
        InputStreamReader isr = new  InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        n=Integer.parseInt(br.readLine());
        for (i=0;i<n;i++)
        {
        s=br.readLine();
        switch(s)
        {
            case "x++":x++;break;
            case "x--":x--;break;
            case "++x":++x;break;
            case "--x":--x;break;
            default: break;

        }
        }
        System.out.println(n);
    }
}


import java.io.*;
import java.util.*;
public class Bit
{

    public static void main(String args[]) throws IOException
    {
         static int n,i,x=0;
         String s;
        InputStreamReader isr = new  InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        n=Integer.parseInt(br.readLine());
        for (i=0;i<n;i++)
        {
        s=br.readLine();
        switch(s)
        {
            case "x++":x++;break;
            case "x--":x--;break;
            case "++x":++x;break;
            case "--x":--x;break;
            default: break;

        }
        }
        System.out.println(x);
    }
}


import java.io.*;
import java.util.*;
public class Bit
{
    public int n,i;
    String s;
    public static void main(String args[]) throws IOException
    {
        InputStreamReader isr = new  InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        n=Integer.parseInt(br.readLine());
        for (i=0;i<n;i++)
        {
        s=br.readLine();
        switch(s)
        {
            case "x++":n++;break;
            case "x--":n--;break;
            case "++x":++n;break;
            case "--x":--n;break;
            default: break;

        }
        }
    }
}


import java.io.*;
import java.util.*;
public class Bit
{

    public static void main(String args[]) throws IOException
    {
         int n,i;
         String s;
        InputStreamReader isr = new  InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        n=Integer.parseInt(br.readLine());
        for (i=0;i<n;i++)
        {
        s=br.readLine();
        switch(s)
        {
            case "x++":n++;break;
            case "x--":n--;break;
            case "++x":++n;break;
            case "--x":--n;break;
            default: break;

        }

        }
        System.out.println(n);
    }
}


import java.io.*;
import java.util.*;
public class Bit
{

    public static void main(String args[]) throws IOException
    {
         int n,i,x=0;
         String s;
        InputStreamReader isr = new  InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        n=Integer.parseInt(br.readLine());
        for (i=0;i<n;i++)
        {
        s=br.readLine();
        switch(s)
        {
            case "X++":x++;break;
            case "X--":x--;break;
            case "++X":++x;break;
            case "--X":--x;break;
            default: break;

        }
        }
        System.out.println(x);
    }
}


import java.io.*;
import java.util.*;
public class Bit
{

    public static void main(String args[]) throws IOException
    {
         int n,i,x=0;
         String s;
        InputStreamReader isr = new  InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        n=Integer.parseInt(br.readLine());
        for (i=0;i<n;i++)
        {
        s=br.readLine();
        switch(s)
        {
            case "x++":x=x+1;break;
            case "x--":x=x-1;break;
            case "++x":x=x+1;break;
            case "--x":x=x-1;break;
            default: break;

        }
        }
        System.out.println(x);
    }
}


package phase_one;
import java.util.Scanner;

public class Phase_one {

    public static void main(String[] args) {
        // TODO code application logic here
        int x =0;
        Scanner input = new Scanner(System.in);
        int size = input.nextInt();
        String []Arr = new String [size];

        for ( int i=0 ; i<size ; i++)
            Arr[i]=input.next();

        for ( int i=0 ; i<size ; i++)
        {
             if (Arr[i].equals("++X"))
                 x++;

             else if ( Arr[i].equals("--X"))
                  x--;

        }
        System.out.println(x);

    }

}


import java.util.Scanner;

public class Phase_one {

    public static void main(String[] args) {
        // TODO code application logic here
        int x =0;
        Scanner input = new Scanner(System.in);
        int size = input.nextInt();
        if ( 1<=size&&size <=150 )
        {

            String op;
            for ( int i=0 ; i<size ; i++)
            {
                op=input.next();

                    if (op.contains("+"))
                        x++;

                    else if (op.contains("-"))
                        x--;

                }

         }
        System.out.println(x);

    }

}


import java.util.Scanner;

public class Phase_one {

    public static void main(String[] args) {
        // TODO code application logic here
        int x =0;
        Scanner input = new Scanner(System.in);
        int size = input.nextInt();
        if ( 1<=size&&size <=150 )
        {

        String []Arr = new String [size];

        for ( int i=0 ; i<size ; i++)
        {
            Arr[i]=input.next();

             if (Arr[i].equals("++X"))
                 x++;

             else if ( Arr[i].equals("--X"))
                  x--;

        }

        System.out.println(x);

        }
    }

}


package phase_one;
import java.util.Scanner;

public class Phase_one {

    public static void main(String[] args) {
        // TODO code application logic here
        int x =0;
        Scanner input = new Scanner(System.in);
        int size = input.nextInt();
        if ( 1<=size&&size <=150 )
        {

        String []Arr = new String [size];

        for ( int i=0 ; i<size ; i++)
        {
            Arr[i]=input.next();

             if (Arr[i].equals("++X"))
                 x++;

             else if ( Arr[i].equals("--X"))
                  x--;

        }

        System.out.println(x);

        }
    }

}


package phase_one;
import java.util.Scanner;

public class Phase_one {

    public static void main(String[] args) {
        // TODO code application logic here
        int x =0;
        Scanner input = new Scanner(System.in);
        int size = input.nextInt();
        String []Arr = new String [size];
        for ( int i=0 ; i<size ; i++)
        {
            Arr[i]=input.next();
             if (Arr[i].equals("++X"))
             {
                 x++;
             }
             else if ( Arr[i].equals("--X"))
             {
                  x--;
             }
        }
        System.out.println(x);

    }

}


package phase_one;
import java.util.Scanner;

public class Phase_one {

    public static void main(String[] args) {
        // TODO code application logic here
        int x =0;
        Scanner input = new Scanner(System.in);
        int size = input.nextInt();
        String []Arr = new String [size];
        for ( int i=0 ; i<size ; i++)
        {
            Arr[i]=input.next();
             if (Arr[i].equals("++X"))
             {
                 x++;
             }
             else if ( Arr[i].equals("--X"))
             {
                  x--;
             }
        }
        System.out.print(x);

    }

}


import java.util.Scanner;

public class Phase_one {

    public static void main(String[] args) {
        // TODO code application logic here
        int x =0;
        Scanner input = new Scanner(System.in);
        int size = input.nextInt();
        if ( 1<=size&&size <=150 )
        {

        String []Arr = new String [size];

        for ( int i=0 ; i<size ; i++)
        {
            Arr[i]=input.next();

             if (Arr[i].equals("++X")||Arr[i].equals("X++"))
                 x++;

             else if ( Arr[i].equals("--X")||Arr[i].equals("--X"))
                  x--;

        }

        System.out.println(x);

        }
    }

}


import java.util.Scanner;

public class Phase_one {

    public static void main(String[] args) {
        // TODO code application logic here
        int x =0;
        Scanner input = new Scanner(System.in);
        int size = input.nextInt();
        if ( 1<=size&&size <=150 )
        {

        String []Arr = new String [size];

        for ( int i=0 ; i<size ; i++)
        {
            Arr[i]=input.next();

             if (Arr[i].equals("++X")||Arr[i].equals("X++")||Arr[i].equals("+"))
                 x++;

             else if ( Arr[i].equals("--X")||Arr[i].equals("--X")||Arr[i].equals("-"))
                  x--;

        }

        System.out.println(x);

        }
    }

}