fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int main() {
  6. char s[20000], Cs[20000];
  7. int maxim = 0, lung[20], k = -1;
  8. while (!cin.eof()){
  9. cin.getline(s, 1000);
  10. int lgl = strlen(s);
  11. if (s[lgl - 1] == '*'){
  12. for (int n = lgl - 1; n >= 0; --n){
  13. if (s[n] == '*')
  14. --lgl;
  15. else {
  16. break;
  17. }
  18. }
  19. }
  20. if (lgl > maxim)
  21. maxim = lgl;
  22. ++k;
  23. lung[k] = lgl;
  24. char aux[1];
  25. strncpy(s + lgl, aux, 1);
  26. strcat(Cs, s);
  27. }
  28. for (int i = 0; i <= k; ++i){
  29. char cuv[1000] = "0";
  30. int c = -1;
  31. for (int j = 0; j < lung[i]; ++j){
  32. ++c;
  33. cuv[c] = Cs[j];
  34. }
  35. int lgc = strlen(cuv);
  36. if (maxim == lgc)
  37. cout << cuv << endl;
  38. if (maxim > lgc){
  39. char ast[1000] = "0";
  40. int nrAst = maxim - lgc;
  41. for (int a = 0; a < nrAst; ++a){
  42. ast[a] = '*';
  43. }
  44. strcat(ast, cuv);
  45. cout << ast << endl;
  46. }
  47. char aux[1000];
  48. strcpy(aux, Cs + lung[i]);
  49. strcpy(Cs, aux);
  50. }
  51. return 0;
  52. }
Success #stdin #stdout 0.01s 5312KB
stdin
Acesta*este
********un****text
***impartit*pe*mai
*multe*linii
stdout
*******Acesta*este
********un****text
***impartit*pe*mai
*******multe*linii