fork download
  1. #include <bits/stdc++.h>
  2. #define ull unsigned long long
  3. #define ll long long
  4. #define el endl
  5. using namespace std;
  6. void input()
  7. {
  8. if (fopen("in.txt", "r"))
  9. {
  10. freopen("in.txt", "r", stdin);
  11. freopen("out.txt", "w", stdout);
  12. }
  13. }
  14. int main()
  15. {
  16. Fast:
  17. input();
  18. //---------------------------------" " UPSOLVE---------------------------------------------------------------
  19.  
  20. int t;
  21. cin >> t;
  22.  
  23. while (t--)
  24. {
  25. string s;
  26. cin >> s;
  27. bool xst = false;
  28. for (int i = 2; i <= s.size(); i++)
  29. {
  30. if ( (s[i - 1] > s[i] && s[i - 1] > s[i - 2])
  31. || (s[i - 1] < s[i] && s[i - 1] < s[i - 2]) )
  32. xst = true;
  33. }
  34. if(xst = true)
  35. cout << "Good"<<el;
  36. else if(xst = false)
  37. cout << "Bad"<<el;
  38. }
  39.  
  40. return 0;
  41. }
  42.  
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
Standard output is empty