MohamedAbdel3al

B. File Name

Sep 25th, 2021 (edited)
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std ;
  4. #define sz(s) int(s.size())
  5. #define all(v) v.begin() , v.end()
  6. #define imin INT_MIN
  7. #define imax INT_MAX
  8. typedef long long ll ;
  9. #define Time cerr << "Time Taken: " << (float)clock() / CLOCKS_PER_SEC << " Secs" << "\n";
  10. #define all(s) s.begin(), s.end()
  11. #define cin(v) for (auto& i : v) cin >> i ;
  12. #define pb(x) push_back(x)
  13. #define getline(s) getline(cin >> ws, s)
  14.  
  15. void ABDEL3AL () {
  16. ios_base::sync_with_stdio(false); cin.tie(nullptr) , cout.tie(nullptr) ;
  17. #ifndef ONLINE_JUDGE
  18. freopen("input.txt" , "r" , stdin) , freopen("output.txt" , "w" , stdout) ;
  19. #endif
  20. Time
  21. }
  22.  
  23. int main() {
  24. ABDEL3AL() ;
  25. int n ; cin >> n ;
  26. string s , ans ;
  27. cin >> s ;
  28. vector < string > v ;
  29. for (int i = 0; i < sz(s); i++) {
  30. if (s[i] == 'x') ans += 'x' ;
  31. else {
  32. v.pb(ans) ;
  33. ans = "" ;
  34. }
  35. }
  36. int sum = 0 ;
  37. for (int i = 0; i < sz(v); i++) {
  38. while (sz(ans) != 2) ans.pop_back() , sum += 1 ;
  39. }
  40. cout << sum << "\n" ;
  41. return 0;
  42. }
  43.  
  44.  
Add Comment
Please, Sign In to add comment