Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- ios::sync_with_stdio(false);
- cin.tie(NULL); cout.tie(NULL);
- string Z[3];
- cin >> Z[0];
- cin >> Z[1];
- cin >> Z[2];
- for(int x = 0; x < Z[0].size(); x++)
- {
- for(int z = 0; z < Z[1].size(); z++)
- {
- if(Z[0][x] == Z[1][z])
- {
- for(int i = 0; i < Z[2].size(); i++)
- {
- for(int q = 0; q < Z[0].size(); q++)
- {
- if(Z[0][q] == Z[2][i] && q != x)
- {
- cout << Z[0] << " " << x + 1 << " " << Z[1] << " " << z + 1 << "\n" << Z[0] << " " << q + 1 << " " << Z[2] << " " << i + 1;
- return 0;
- }
- }
- for(int q = 0; q < Z[1].size(); q++)
- {
- if(Z[1][q] == Z[2][i] && q != z)
- {
- cout << Z[0] << " " << x + 1 << " " << Z[1] << " " << z + 1 << "\n" << Z[1] << " " << q + 1 << " " << Z[2] << " " << i + 1;
- return 0;
- }
- }
- }
- }
- }
- }
- for(int x = 0; x < Z[0].size(); x++)
- {
- for(int z = 0; z < Z[2].size(); z++)
- {
- if(Z[0][x] == Z[2][z])
- {
- for(int i = 0; i < Z[1].size(); i++)
- {
- for(int q = 0; q < Z[0].size(); q++)
- {
- if(Z[0][q] == Z[1][i] && q != x)
- {
- cout << Z[0] << " " << x + 1 << " " << Z[2] << " " << z + 1 << "\n" << Z[0] << " " << q + 1 << " " << Z[1] << " " << i + 1;
- return 0;
- }
- }
- for(int q = 0; q < Z[2].size(); q++)
- {
- if(Z[2][q] == Z[1][i] && q != z)
- {
- cout << Z[0] << " " << x + 1 << " " << Z[2] << " " << z + 1 << "\n" << Z[2] << " " << q + 1 << " " << Z[1] << " " << i + 1;
- return 0;
- }
- }
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement