fork(1) download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. const int MAX_LENGTH = 100;
  6.  
  7.  
  8. int main() {
  9. char array[MAX_LENGTH + 1], mt[MAX_LENGTH + 1][MAX_LENGTH + 1], secMt[MAX_LENGTH + 1][MAX_LENGTH + 1];
  10. int counter = 0, lengthFin = 0;
  11.  
  12.  
  13. while (cin.getline(array, MAX_LENGTH)) {
  14. int asterix = 0;
  15. int length = strlen(array);
  16. for (int j = 0; j < length; ++j) {
  17. if (array[j] == '*') {
  18. ++asterix;
  19. }
  20. }
  21. //cout << asterix << " " << length<< "<-\n";
  22. if (asterix < length) {
  23. for (int j = 0; j < length; ++j) {
  24. mt[counter][j] = array[j];
  25. //cout << mt[counter][j] << "<->" << array[j]<< "\n";
  26. }
  27. ++counter;
  28. }
  29. lengthFin = length;
  30. }
  31.  
  32.  
  33. for (int i = 0 ; i < counter; ++i) {
  34. for (int j = 0 ; j < lengthFin; ++j) {
  35. //cout << mt[i][j];
  36. }
  37. // cout << counter<<".\n"; //counter = 3
  38. }
  39.  
  40. // TOTUL BINE
  41.  
  42. int linie = counter ; //
  43. for (int i = 0; i < counter; ++i, --linie) {
  44. for (int j = 0; j < lengthFin; ++j) {
  45. // cout << mt[i][j] <<".";
  46. if ((mt[i][j] >= 'a' && mt[i][j] <= 'z') || (mt[i][j] >= 'A' && mt[i][j] <= 'Z')) {
  47. cout << linie - 1 <<" " << j <<" \n";
  48. secMt[linie - 1][j] = mt[i][j];
  49. }
  50. }
  51. // cout <<" \n";
  52. }
  53.  
  54. for (int i = 0 ; i < counter; ++i) {
  55. for (int j = 0 ; j < lengthFin; ++j) {
  56. // cout << secMt[i][j];
  57. }
  58. //cout <<".\n";
  59. }
  60.  
  61.  
  62. return 0;
  63. }
  64.  
  65.  
  66. /*
  67. a*c*
  68. **sd
  69. v*g*
  70. ****
  71.  
  72. =======
  73. ****
  74. a*sa
  75. dd*b
  76. ***z
  77. */
Success #stdin #stdout 0.01s 5288KB
stdin
AmAmAb
Nunera
Ilarel
Mt*t*a
Ae***u
L****r
stdout
5 0 
5 1 
5 2 
5 3 
5 4 
5 5 
4 0 
4 1 
4 2 
4 3 
4 4 
4 5 
3 0 
3 1 
3 2 
3 3 
3 4 
3 5 
2 0 
2 1 
2 3 
2 5 
1 0 
1 1 
1 5 
0 0 
0 5