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];
  10. int counter = 0, lengthFin = 0;
  11. while (cin.getline(array, MAX_LENGTH)) {
  12. int length = strlen(array);
  13. for (int j = 0; j < length; ++j) {
  14. mt[counter][j] = array[j];
  15. }
  16. if (length > lengthFin) {
  17. lengthFin = length;
  18. }
  19. ++counter;
  20. }
  21.  
  22. for (int i = 0; i < lengthFin; ++i) {
  23. for (int j = 0; j < lengthFin; ++j) {
  24. if (mt[i][j] == ' ') {
  25. mt[i][j] = '*';
  26. }
  27. }
  28. }
  29.  
  30. for (int i = 0; i < lengthFin; ++i) {
  31. for (int j = 0; j < lengthFin; ++j) {
  32. cout << mt[i][j] <<" ";
  33. }
  34. cout <<",\n"; //
  35. }
  36.  
  37.  
  38. for (int i = lengthFin - 1; i >= 0; --i) {
  39. int asterix = 0;
  40. for (int j = 0 ; j < lengthFin; ++j) {
  41. if (mt[j][i] == '*') {
  42. ++asterix;
  43. }
  44. if ((mt[j][i] >= 'a' && mt[j][i] <= 'z') || (mt[j][i] >= 'A' && mt[j][i] <= 'Z')) {
  45. //cout << mt[j][i];
  46. }
  47. }
  48. if ( asterix < lengthFin) {
  49. //cout <<"\n";
  50. }
  51. }
  52. return 0;
  53. }
Success #stdin #stdout 0.01s 5320KB
stdin
amandina
verde
cap
sarpe
alo
balta
rosu
albastru
stdout
a m a n d i n a ,
v e r d e    ,
c a p      ,
s a r p e    ,
a l o      ,
b a l t a    ,
r o s u     ,
a l b a s t r u ,