Advertisement
Guest User

Mój kod - kolejka

a guest
Apr 24th, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int t, dlugosc;
  5. string wejscie;
  6. int main()
  7. {
  8. cin >> t;
  9. for (int i = 0; i < t; i++)
  10. {
  11. cin >> wejscie;
  12. dlugosc = wejscie.length();
  13. for (int n = dlugosc-1; n > 0; n--)
  14. {
  15. if (wejscie[n]>wejscie[n-1])
  16. {
  17. wejscie[n - 1] = wejscie[n];
  18. wejscie[n] = NULL;
  19. }
  20. }
  21. cout << wejscie << endl;
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement