fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_SIZE = 20;
  5.  
  6. int main() {
  7. int n;
  8. cin >> n;
  9. char mt[MAX_SIZE][MAX_SIZE];
  10.  
  11. // Citirea matricei
  12. for (int i = 0; i < n; ++i) {
  13. for (int j = 0; j < n; ++j) {
  14. cin >> mt[i][j];
  15. }
  16. }
  17.  
  18. // Generarea matricei modificate
  19. for (int i = 1; i < n; ++i) {
  20. for (int j = 0; j < n; ++j) {
  21. mt[i][j] = mt[i - 1][j] + 1; // Incrementăm fiecare caracter cu 1
  22. if (mt[i][j] > 'z') { // Dacă depășește 'z', revenim la 'a'
  23. mt[i][j] = 'a';
  24. }
  25. }
  26. }
  27.  
  28. // Construirea parolei finale
  29. string password;
  30. for (int i = 0; i < n; ++i) {
  31. for (int j = 0; j < n; ++j) {
  32. password += mt[i][j];
  33. }
  34. }
  35.  
  36. cout << password << endl;
  37. return 0;
  38. }
  39.  
Success #stdin #stdout 0.01s 5284KB
stdin
3
a b c
b c d
x t h
stdout
abcbcdcde