fork 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 length = strlen(array);
  15. for (int j = 0; j < length; ++j) {
  16. mt[counter][j] = array[j];
  17. }
  18. if (length > lengthFin) {
  19. lengthFin = length;
  20. }
  21. ++counter;
  22. }
  23. char a =32;
  24. // cout << lengthFin <<" \n";
  25. for (int i = 0; i < lengthFin; ++i) {
  26. for (int j = 0; j < lengthFin; ++j) {
  27. if (mt[i][j] == a) {
  28. cout << "DA";
  29. mt[i][j] = '*';
  30. }
  31. }
  32. }
  33.  
  34. for (int i = 0; i < lengthFin; ++i) {
  35. for (int j = 0; j < lengthFin; ++j) {
  36. // cout << mt[i][j] <<" ";
  37. }
  38. // cout <<",\n"; //
  39. }
  40.  
  41. /*
  42.   if ((array[j] >= 'a' && array[j] <= 'z') || (array[j] >= 'A' && array[j] <= 'Z')) {
  43. mt[counter][j] = array[j];
  44. }
  45. */
  46.  
  47.  
  48.  
  49.  
  50.  
  51. for (int i = lengthFin - 1; i >= 0; --i) {
  52. int asterix = 0;
  53. for (int j = 0 ; j < lengthFin; ++j) {
  54. if (mt[j][i] == '*') {
  55. ++asterix;
  56. }
  57.  
  58. if ((mt[j][i] >= 'a' && mt[j][i] <= 'z') || (mt[j][i] >= 'A' && mt[j][i] <= 'Z')) {
  59. ///cout << mt[j][i]<< ".";
  60.  
  61. //mt[counter][j] = array[j];
  62. }
  63. //cout << mt[j][i]<< " ";
  64. }
  65. if ( asterix < lengthFin) {
  66. //cout <<",\n"; //
  67. }
  68.  
  69.  
  70. }
  71. return 0;
  72. }
  73.  
  74.  
  75. /*
  76. a*c*
  77. **sd
  78. v*g*
  79. ****
  80. ==============
  81.  *****
  82. *Ulei
  83. Vi**D
  84. Pahar
  85. CANA*
  86. =======
  87. ****
  88. a*sa
  89. dd*b
  90. ***z
  91. ===========]
  92.  
  93. ****
  94. a*sa
  95. dd*b
  96. ***z
  97. */
Success #stdin #stdout 0s 5312KB
stdin
amandina
verde
cap
sarpe
alo
balta
rosu
albastru
stdout
Standard output is empty