vakho

2010 - Episode IV Problem A

Sep 25th, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <fstream>
  2. #include <algorithm>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     string str;
  10.     int discount = 5;
  11.  
  12.     ifstream ifs("discount.in");
  13.     getline(ifs, str);
  14.     ifs.close();
  15.  
  16.     sort(str.begin(), str.end());
  17.    
  18.     str[0] += 32;
  19.     for (int i = 1; i < str.size(); i++)
  20.     {
  21.         if (str[i] != str[i - 1])
  22.         {
  23.             discount += 5;
  24.         }
  25.     }
  26.  
  27.     ofstream ofs("discount.out");
  28.     ofs << discount << '%' << endl << str << endl;
  29.     ofs.close();
  30. }
Advertisement
Add Comment
Please, Sign In to add comment