Seal_of_approval

PrSet13

Jul 6th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <set>
  4. #include <string>
  5. #include <algorithm>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     ifstream in("/Users/masha/Documents/PrSet13/PrSet13/input");
  12.     int n;
  13.     in >> n;
  14.     set<char>::iterator it;
  15.    
  16.     set<char> alphabet;
  17.    
  18.     for (char c ='a'; c <= 'z'; c++)
  19.         alphabet.insert(c);
  20.    
  21.     string s;
  22.     getline(in, s);
  23.     for (int i = 0; i < n; i++)
  24.     {
  25.         set<char> result;
  26.         getline(in,s);
  27.         transform(s.begin(), s.end(), s.begin(), ::tolower);
  28.         set <char> str(s.begin(),s.end());
  29.        
  30.         set_difference(alphabet.begin(), alphabet.end(), str.begin(), str.end(),
  31.                       std::inserter(result, result.end()));
  32.        
  33.         for (it = result.begin(); it != result.end(); it++)
  34.             cout << *it << " ";
  35.         cout << endl;
  36.     }
  37.    
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment