Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* e159 */
- /* AC (5ms, 1000KB) */
- #include <iostream>
- #include <string>
- #define spIO ios::sync_with_stdio(false);cin.tie(0)
- using namespace std;
- typedef long long ll;
- typedef long double lb;
- string s1, s2;
- inline bool e(int st1, int st2, int size)
- {
- if (size & 1)
- {
- for (int i = 0; i < size; ++i)
- if (s1[st1 + i] != s2[st2 + i])
- return false;
- return true;
- }
- return e(st1, st2, size / 2) && e(st1 + size / 2, st2 + size / 2, size / 2) || e(st1 + size / 2, st2, size / 2) && e(st1, st2 + size / 2, size / 2);
- }
- int main()
- {
- spIO;
- getline(cin, s1);
- getline(cin, s2);
- cout << (e(0, 0, s1.size()) ? "yes" : "no");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement