G2A Many GEOs
SHARE
TWEET

Untitled

a guest Apr 8th, 2020 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     string s;
  7.     getline(cin, s);
  8.     if (s.size() == 0) {
  9.         cout << 0;
  10.         return 0;
  11.     }
  12.     int res = 0;
  13.     string word = "";
  14.     for (int i = 0; i < s.size(); ++i) {
  15.         if (s[i] == '-') {
  16.             if (i > 0 && i < s.size() - 1) {
  17.             if (((s[i - 1] >= 'a' && s[i - 1] <= 'z') || (s[i - 1] >= 'A' && s[i - 1] <= 'Z')) &&
  18.                 ((s[i + 1] >= 'a' && s[i + 1] <= 'z') || (s[i + 1] >= 'A' && s[i + 1] <= 'Z'))) {
  19.                 s[i] = 'a';
  20.             }
  21.         }
  22.         }
  23.     }
  24.     for (size_t i = 0; i < s.size(); ++i) {
  25.         if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z')) {
  26.             word += s[i];
  27.         } else {
  28.             if (word.size() > 0) {
  29.                 res++;
  30.             }
  31.             word = "";
  32.         }
  33.     }
  34.     if (word.size() > 0) {
  35.                 res++;
  36.             }
  37.  
  38.     cout << res << endl;
  39.     return 0;;
  40. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top