artemgf

Чизбургер этот не нужен тебе

Apr 21st, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <string>
  4. #include <algorithm>
  5. #include <vector>
  6.  
  7. using namespace std;
  8.  
  9. vector <string> verb, noun, adjective, promesh;
  10. string prom;
  11. int start, zap = 0;
  12.  
  13. int main()
  14. {
  15.  
  16.     getline(cin, prom);
  17.  
  18.     for (int i = 0; i <= prom.size(); i++)
  19.     {
  20.         if (prom[i] == '(' || prom[i] == '[' || prom[i] == '{')
  21.         {
  22.             string s = prom.substr(start, i-start);
  23.             if (s[0] == ',')
  24.                 promesh.push_back(s);
  25.             start = i + 1;
  26.         }
  27.         else
  28.             if (prom[i] == ')')
  29.             {
  30.                 adjective.push_back(prom.substr(start, i - start));
  31.             }
  32.             else
  33.                 if (prom[i] == '}')
  34.                 {
  35.                     noun.push_back(prom.substr(start, i - start));
  36.                 }
  37.                 else
  38.                     if (prom[i] == ']')
  39.                     {
  40.                         verb.push_back(prom.substr(start, i - start));
  41.                     }
  42.                     else
  43.                         if (prom[i] == ',')
  44.                         {
  45.                             zap++;
  46.                             start = i;
  47.                         }
  48.     }
  49.  
  50.     for (int i = 0; i <= zap; i++)
  51.     {
  52.         if (i == 0)
  53.         {
  54.             if (noun[i][0] >= 97 && noun[i][0] <= 122)
  55.                 noun[i][0] = noun[i][0] - 32;
  56.             if (adjective[i][0] >= 65 && adjective[i][0] <= 90)
  57.                 adjective[i][0] = adjective[i][0] + 32;
  58.             if (verb[i][0] >= 65 && verb[i][0] <= 90)
  59.                 verb[i][0] = verb[i][0] + 32;
  60.         }
  61.         cout << noun[i] << " " << adjective[i] << " " << verb[i];
  62.         if (i <= zap-1)
  63.             cout << promesh[i];
  64.     }
  65.  
  66.     _getch();
  67.     return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment