#include #include #include #define map unordered_map #define set unordered_set using namespace std; int main(int argc, char **argv) { int rowC; while (cin >> rowC) { string row; char best = -1; int x,y; map found; for (int i=0; i> row; for (string::size_type j = 0; j < row.length(); ++j) { if (found.find(row[j]) == found.end()) { y = i+1; x = j+1; found[row[j]] = 1; } else { ++ found[row[j]]; } } } for (auto bf = found.begin(); bf != found.end(); ++bf) { //printf("%c %d\n", bf->first, bf->second); if (bf->second == rowC-1) { best = bf->first; break; } } printf("%d %d %c\n", y, x, best); } return 0; }