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. //cout << counter << " " << lengthFin; // 3 4
  42.  
  43. int linie = 0 ; //
  44. for (int i = counter ; i >= 0; --i, ++linie) {
  45. int col = 0;
  46. for (int j = 0; j < lengthFin - 1; ++j, ++col) {
  47. //cout << mt[j][i] <<".";
  48. //cout << j <<i <<".";
  49. if ((mt[j][i] >= 'a' && mt[j][i] <= 'z') || (mt[j][i] >= 'A' && mt[j][i] <= 'Z')) {
  50. //cout << col - 1 <<" " << i <<" \n";
  51. secMt[linie][col] = mt[j][i];
  52. }
  53. }
  54. // cout <<" \n";
  55. }
  56.  
  57. for (int i = 1 ; i <= counter; ++i) {
  58. for (int j = 0 ; j <= lengthFin + 1; ++j) {
  59. cout << secMt[i][j] ;
  60. }
  61. cout <<".\n";
  62. }
  63.  
  64.  
  65. return 0;
  66. }
  67.  
  68.  
  69. /*
  70. a*c*
  71. **sd
  72. v*g*
  73. ****
  74.  
  75. =======
  76. ****
  77. a*sa
  78. dd*b
  79. ***z
  80. ===========]
  81.  
  82. ****
  83. a*sa
  84. dd*b
  85. ***z
  86. */
Success #stdin #stdout 0.01s 5256KB
stdin
AmAmAb
Nunera
Ilarel
Mt*t*a
Ae***u
L****r
stdout
balau.
Are.
mert.
Ana.
multe.
ANIMA.