/* * File: tribune.cpp * Author: cteam037 * * Created on October 22, 2016, 9:44 AM */ #include #include #include #include using namespace std; /* * */ int main(int argc, char** argv) { ios::sync_with_stdio(false); int size, differentLine = 0, differentCollumn = 0; int linesSum[26]; int collumnsSum[26]; bool colFound = false, rowFound = false; string lines[26]; while (cin >> size) { memset(linesSum, 0, 26 * sizeof(*linesSum)); memset(collumnsSum, 0, 26 * sizeof(*collumnsSum)); rowFound = colFound = false; for (int i = 0; i < size; ++i) { cin >> lines[i]; for (unsigned int j = 0; j < lines[i].length(); ++j) { collumnsSum[j] += lines[i].at(j); linesSum[i] += lines[i].at(j); } } for (int j = 0; j < size - 2 && (!rowFound || !colFound); ++j) { if (linesSum[j] != linesSum[j + 1]) { if (linesSum[j + 1] == linesSum[j + 2]) { differentLine = j; rowFound = true; } else { differentLine = j + 1; rowFound = true; } } else if (linesSum[j] != linesSum[j + 2]) { differentLine = j + 2; rowFound = true; } if (collumnsSum[j] != collumnsSum[j + 1]) { if (collumnsSum[j + 1] == collumnsSum[j + 2]) { differentCollumn = j; colFound = true; } else { differentCollumn = j + 1; colFound = true; } } else if (collumnsSum[j] != collumnsSum[j + 2]) { differentCollumn = j + 2; colFound = true; } } char c = lines[differentLine].at(differentCollumn) - (linesSum[differentLine] - linesSum[differentLine == 0 ? 1 : differentLine - 1]); cout << (differentLine + 1) << ' ' << (differentCollumn + 1) << ' ' << c << endl; } return 0; }