fork download
  1. #include <bits/stdc++.h>
  2. //freopen("transmitters.in","r",stdin);
  3. //cout<<fixed<<setprecision(6)<<n<<endl;
  4. // transform(s.begin(), s.end(), s.begin(), ::tolower);
  5. //double PI=3.14159265359,c=0;
  6. #define ll long long
  7. //#define all(v) v.begin(),v.end()
  8. using namespace std;
  9. void fast()
  10. {
  11. std::ios_base::sync_with_stdio(0);
  12. cin.tie(0);
  13. cout.tie(0);
  14. }
  15. //long long arr[10];
  16. int main ()
  17. {
  18. fast();
  19. long long n=0,t,m=0,l,x=0,y=0;
  20. string s;
  21. cin>>s;
  22. for(int i=0;i<s.size();i++)
  23. {
  24. if(s[i]=='L')
  25. x--;
  26. else if(s[i]=='R')
  27. x++;
  28. else if(s[i]=='D')
  29. y--;
  30. else
  31. y++;
  32. }
  33. cout<<x<<" "<<y<<"\n";
  34. //system("pause");
  35. return 0;
  36. }
Success #stdin #stdout 0s 4548KB
stdin
Standard input is empty
stdout
0 0