SHARE
TWEET

Untitled

a guest Dec 23rd, 2017 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4. #include <cmath>
  5.  
  6. using namespace std;
  7.  
  8. string a = "qwertyuiopasdfghjklzxcvbnm";
  9.  
  10. int main()
  11. {
  12.     int n, counter = 0;
  13.     cin >> n;
  14.    
  15.     for(int i = 0; i < n; i++)
  16.     {
  17.         char c;
  18.         string s;
  19.         cin >> c >> s;
  20.        
  21.         if(c == '!')
  22.         {
  23.             string st = "";
  24.             for(int j = 0; j < s.size(); j++)
  25.             {
  26.                 if(st.find(s[j]) == string::npos)
  27.                     st.push_back(s[j]);
  28.             }
  29.        
  30.             a = st;
  31.         }
  32.        
  33.         if(c == '.')
  34.         {
  35.             for(int j = 0; j < s.size(); j++)
  36.                 a.erase(a.find(s[j]) + a.begin());
  37.         }
  38.        
  39.         if(c == '?')
  40.             counter++;
  41.     }
  42.    
  43.     cout << counter << ' ' << a.size();
  44. }
RAW Paste Data
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