Language: C++

int main(int, char**)
{
	int dummy = 0;
	std::cin >> dummy;
	std::string buff_s;
	std::string buff_t;
	std::cin >> buff_s >> buff_t;

	int place1_s = 0;
	int place2_s = 0;
	int place1_t = 0;

	auto search = [](const std::string& str, const int start, const int delta)->int
	{
		for (int index = start; str.length() > index; index += delta)
		{
			if ('.' == str[index])
			{
				return index;
			}
		}
		return -1;
	};
	while (buff_s != buff_t)
	{
		std::cout << buff_s << std::endl;
		std::cout << buff_t << std::endl;
		std::cout << std::endl;

		place1_s = search(buff_s, 0, 1);
		place1_t = search(buff_t, 0, 1);
		if (place1_s > place1_t || (-1 == place1_s || -1 == place1_t))
		{
			break;
		}
		if (place1_s < place1_t)
		{
			place2_s = search(buff_s, place1_s + 1, 1);
			if (-1 == place2_s)
			{
				break;
			}
			if (3 <= place2_s - place1_s)
			{
				buff_s[place1_s] = 'o';
				buff_s[place1_s + 1] = '.';
				buff_s[place2_s] = 'o';
				buff_s[place2_s - 1] = '.';
				continue;
			}
		}
		if (place1_s == place1_t)
		{
			buff_s = buff_s.substr(place1_s + 1);
			buff_t = buff_t.substr(place1_t + 1);
		}

		place1_s = search(buff_s, static_cast<int>(buff_s.length()) - 1, -1);
		place1_t = search(buff_t, static_cast<int>(buff_t.length()) - 1, -1);
		if (place1_s < place1_t || (-1 == place1_s || -1 == place1_t))
		{
			break;
		}
		if (place1_s > place1_t)
		{
			place2_s = search(buff_s, place1_s - 1, -1);
			if (-1 == place2_s)
			{
				break;
			}
			if (3 <= place1_s - place2_s)
			{
				buff_s[place1_s] = 'o';
				buff_s[place1_s - 1] = '.';
				buff_s[place2_s] = 'o';
				buff_s[place2_s + 1] = '.';
				continue;
			}
		}
		if (place1_s == place1_t)
		{
			buff_s = buff_s.substr(0, place1_s);
			buff_t = buff_t.substr(0, place1_t);
		}

		place1_s = static_cast<int>(buff_s.find("."));
		if (-1 == place1_s)
		{
			break;
		}
		place1_s = static_cast<int>(buff_s.find(".oo", place1_s));
		if (-1 == place1_s)
		{
			break;
		}
		place2_s = static_cast<int>(buff_s.find(".", place1_s + 1));
		if (-1 == place2_s)
		{
			break;
		}
		buff_s[place1_s] = 'o';
		buff_s[place1_s + 1] = '.';
		buff_s[place2_s] = 'o';
		buff_s[place2_s - 1] = '.';
	}

	std::cout << (buff_s == buff_t ? "Yes" : "No") << std::endl;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:4:14: error: 'cin' is not a member of 'std'
    4 |         std::cin >> dummy;
      |              ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | int main(int, char**)
a.cc:5:14: error: 'string' is not a member of 'std'
    5 |         std::string buff_s;
      |              ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | int main(int, char**)
a.cc:6:14: error: 'string' is not a member of 'std'
    6 |         std::string buff_t;
      |              ^~~~~~
a.cc:6:14: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:7:14: error: 'cin' is not a member of 'std'
    7 |         std::cin >> buff_s >> buff_t;
      |              ^~~
a.cc:7:14: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:7:21: error: 'buff_s' was not declared in this scope
    7 |         std::cin >> buff_s >> buff_t;
      |                     ^~~~~~
a.cc:7:31: error: 'buff_t' was not declared in this scope
    7 |         std::cin >> buff_s >> buff_t;
      |                               ^~~~~~
a.cc:13:37: error: 'string' in namespace 'std' does not name a type
   13 |         auto search = [](const std::string& str, const int start, const int delta)->int
      |                                     ^~~~~~
a.cc:13:32: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
   13 |         auto search = [](const std::string& str, const int start, const int delta)->int
      |                                ^~~
a.cc:23:10: error: expected ')' before ';' token
   23 |         };
      |          ^
      |          )
a.cc:13:25: note: to match this '('
   13 |         auto search = [](const std::string& str, const int start, const int delta)->int
      |                         ^
a.cc: In lambda function:
a.cc:23:10: error: expected '{' before ';' token
   23 |         };
      |          ^
a.cc: In function 'int main(int, char**)':
a.cc:26:22: error: 'cout' is not a member of 'std'
   26 |                 std::cout << buff_s << std::endl;
      |                      ^~~~
a.cc:26:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:26:45: error: 'endl' is not a member of 'std'
   26 |                 std::cout << buff_s << std::endl;
      |                                             ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | int main(int, char**)
a.cc:27:22: error: 'cout' is not a member of 'std'
   27 |                 std::cout << buff_t << std::endl;
      |                      ^~~~
a.cc:27:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:45: error: 'endl' is not a member of 'std'
   27 |                 std::cout << buff_t << std::endl;
      |                                             ^~~~
a.cc:27:45: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:28:22: error: 'cout' is not a member of 'std'
   28 |                 std::cout << std::endl;
      |                      ^~~~
a.cc:28:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:28:35: error: 'endl' is not a member of 'std'
   28 |                 std::cout << std::endl;
      |                                   ^~~~
a.cc:28:35: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:107:14: error: 'cout' is not a member of 'std'
  107 |         std::cout << (buff_s == buff_t ? "Yes" : "No") << std::endl;
      |              ^~~~
a.cc:107:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:107:64: error: 'endl' is not a member of 'std'
  107 |         std::cout << (buff_s == buff_t ? "Yes" : "No") << std::endl;
      |                                                                ^~~~
a.cc:107:64: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'