Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- using namespace std;
- void swap (char& a, char& b) {
- char c = a;
- a = b;
- b = c;
- }
- string gira(string s) {
- int n = s.size();
- for (int i = 0; i < n/2; ++i) {
- swap(s[i], s[(n-1)-i]);
- }
- return s;
- }
- bool son_iguals(string s1, string s2) {
- int n = s1.size();
- string s3 = gira(s1);
- for (int i = 0; i < n; ++i) {
- if (s1[i] != s2[i] and s3[i] != s2[i]) return false;
- }
- return true;
- }
- int main() {
- string s1, s2;
- while (cin >> s1 and cin >> s2) {
- if (son_iguals(s1, s2)) cout << "yes" << endl;
- else cout << "no" << endl;
- }
- }
Add Comment
Please, Sign In to add comment