fork download
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. stack <string> sk;
  6. int main() {
  7. ios::sync_with_stdio(false);
  8. cin.tie(nullptr);
  9. //freopen(stdin);
  10.  
  11. int n;
  12. cin>>n;
  13. if(n%2!=0)
  14. {
  15. cout<<"RA\n";
  16. }
  17. else
  18. {
  19. while(n--)
  20. {
  21. string s;
  22. cin>>s;
  23. bool flag=true;
  24. if(s.substr(0,3)!="End")
  25. {
  26. sk.push(s);
  27. }
  28. else
  29. {
  30. if(s.substr(3)==sk.top())
  31. {
  32. sk.pop();
  33. }
  34. else
  35. {
  36. flag=false;
  37. break;
  38. }
  39. }
  40. }
  41. if(sk.size()==0)
  42. {
  43. cout<<"ACC\n";
  44. }
  45. else
  46. {
  47. cout<<"WA\n";
  48. }
  49. }
  50.  
  51. return 0;
  52. }
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
ACC