Dang_Quan_10_Tin

CHANGE TS10 Da Nang 2021-2022

Jan 6th, 2022
792
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #define task "CHANGE"
  2.  
  3. #include <iostream>
  4. #include <cstdio>
  5.  
  6. using namespace std;
  7.  
  8. using ll = long long;
  9. using ld = long double;
  10.  
  11. constexpr int N = 1e5 + 5;
  12. string s, ans;
  13.  
  14. void Read()
  15. {
  16.     cin >> s;
  17. }
  18.  
  19. void Solve()
  20. {
  21.     ans = "12345678";
  22.  
  23.     for (auto i : s)
  24.         if (i == 'R')
  25.             ans = ans.substr(ans.size() - 1, 1) + ans.substr(0, ans.size() - 1);
  26.         else
  27.             ans = ans.substr(1, ans.size() - 1) + ans.substr(0, 1);
  28.  
  29.     cout << ans;
  30. }
  31.  
  32. int32_t main()
  33. {
  34.     ios::sync_with_stdio(0);
  35.     cin.tie(0);
  36.     cout.tie(0);
  37.     if (fopen(task ".INP", "r"))
  38.     {
  39.         freopen(task ".INP", "r", stdin);
  40.         freopen(task ".OUT", "w", stdout);
  41.     }
  42.  
  43.     Read();
  44.     Solve();
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment