fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. string slowo;
  6. int nTestow, test;
  7. cin >> slowo;
  8. cin >> nTestow;
  9. for(int i=0;i<nTestow;i++){
  10. cin >> test;
  11. if(test==1){
  12. cout << slowo;
  13. if(i<nTestow-1) cout << endl;
  14. }
  15. if(test==0){
  16. cout << slowo[slowo.length()-1];
  17. if(i<nTestow-1) cout << endl;
  18. }
  19. if(test<0){
  20. for(int j=slowo.length();j>=0;j--){
  21. cout << slowo[j];
  22. if(j<=slowo.length()-1&&j>0){
  23. for(int k=test+1;k<0;k++){
  24. cout << " ";
  25. }}
  26. }
  27. if(i<nTestow-1)cout << endl;
  28. }
  29. if(test>0 && test!=1){
  30. for(int j=0;j<slowo.length();j++){
  31. cout << slowo[j];
  32. if(j<slowo.length()-1){
  33. for(int k=0;k<test-1;k++){
  34. cout << " ";
  35. }}
  36. }
  37. if(i<nTestow-1)cout << endl;
  38. }
  39. }
  40. return 0;
  41. }
Success #stdin #stdout 0s 16064KB
stdin
FRAKTAL
5
-2
-1
0
1
2
stdout
L A T K A R F
LATKARF
L
FRAKTAL
F R A K T A L