Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <algorithm>
- #include <vector>
- using namespace std;
- vector <string> verb, noun, adjective, promesh;
- string prom;
- int start, zap = 0;
- int main()
- {
- getline(cin, prom);
- for (int i = 0; i <= prom.size(); i++)
- {
- if (prom[i] == '(' || prom[i] == '[' || prom[i] == '{')
- {
- string s = prom.substr(start, i-start);
- if (s[0] == ',')
- promesh.push_back(s);
- start = i + 1;
- }
- else
- if (prom[i] == ')')
- {
- adjective.push_back(prom.substr(start, i - start));
- }
- else
- if (prom[i] == '}')
- {
- noun.push_back(prom.substr(start, i - start));
- }
- else
- if (prom[i] == ']')
- {
- verb.push_back(prom.substr(start, i - start));
- }
- else
- if (prom[i] == ',')
- {
- zap++;
- start = i;
- }
- }
- for (int i = 0; i <= zap; i++)
- {
- if (i == 0)
- {
- if (noun[i][0] >= 97 && noun[i][0] <= 122)
- noun[i][0] = noun[i][0] - 32;
- if (adjective[i][0] >= 65 && adjective[i][0] <= 90)
- adjective[i][0] = adjective[i][0] + 32;
- if (verb[i][0] >= 65 && verb[i][0] <= 90)
- verb[i][0] = verb[i][0] + 32;
- }
- cout << noun[i] << " " << adjective[i] << " " << verb[i];
- if (i <= zap-1)
- cout << promesh[i];
- }
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment