fork(1) download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. const int MAX_LENGTH = 100;
  6.  
  7. int main() {
  8. char array[MAX_LENGTH + 1], mt[MAX_LENGTH + 1][MAX_LENGTH + 1], secMt[MAX_LENGTH + 1][MAX_LENGTH + 1];
  9. int counter = 0, lengthFin = 0;
  10. while (cin.getline(array, MAX_LENGTH)) {
  11. int length = strlen(array);
  12. for (int j = 0; j < length; ++j) {
  13. mt[counter][j] = array[j];
  14. }
  15. ++counter;
  16. lengthFin = length;
  17. }
  18. int linie = lengthFin - 1;
  19. for (int i = 0; i < lengthFin; ++i, --linie) {
  20. for (int j = 0; j < lengthFin; ++j) {
  21. if ((mt[j][i] >= 'a' && mt[j][i] <= 'z') || (mt[j][i] >= 'A' && mt[j][i] <= 'Z')) {
  22. secMt[linie][j] = mt[j][i];
  23. }
  24. }
  25. }
  26. for (int i = 0 ; i < lengthFin; ++i) {
  27. for (int j = 0 ; j < lengthFin; ++j) {
  28. cout << secMt[i][j];
  29. }
  30. cout <<"\n";
  31. }
  32. return 0;
  33. }
Success #stdin #stdout 0.01s 5320KB
stdin
****
a*sa
dd*b
***z
stdout
abz
s
d
ad