Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //bydlokod!!! yeeeah! try'a doubt, dude=)
- //shit code!! nevertheless, it works! olololololo Onotole is watching!
- //FREEDOM EQUALITY UPYACKA
- //E=m*C^2
- //dirty boys
- #pragma comment(linker, "/STACK:5000000")
- #define _CRT_SECURE_NO_WARNINGS
- #include <cstdio>
- #include <ctime>
- #include <cstdlib>
- #include <iostream>
- #include <algorithm>
- #include <cmath>
- #include <set>
- #include <vector>
- #include <stack>
- #include <fstream>
- #include <string>
- #include <cstring>
- #include <queue>
- #include <utility>
- using namespace std;
- double const PI=2*asin(1.0);
- long long const INF=~(1<<31);
- double const EPS=0.000000001;
- long long const SUP=-INF-1;
- long long const BASE=6;
- #define PB push_back
- #define sqr(x) (x)*(x)
- vector<int> to_vector(long long n){
- long long k=n;
- vector<int> ans;
- while(k != 0){
- ans.push_back(k%10);
- k/=10;
- }
- reverse(ans.begin(),ans.end());
- return ans;
- }
- long long to_int(vector<int> a){
- long long ans=0;
- for(int i=0;i<a.size();i++){
- ans=ans*10+a[i];
- }
- return ans;
- }
- long long perm(long long n,long long l,long long r){
- vector<int> ans;
- long long cnt=0,u,k=n;
- while(k != 0){
- ans.push_back(k%10);
- k/=10;
- }
- sort(ans.begin(),ans.end());
- u=to_int(ans);
- if(u <= r && u >= l && ans[0] != 0) cnt++;
- while(next_permutation(ans.begin(),ans.end())){
- u=to_int(ans);
- if(u <= r && u >= l && ans[0] != 0) cnt++;
- }
- return (cnt == 2 )?1:0;
- }
- int cnt=0;
- vector<string> voc;
- string grab(vector<pair<string,string> > a){
- string ans;
- for(int i=0;i<a.size();i++){
- ans+=a[i].second;
- ans+=' ';
- }
- ans[ans.length()-1]='.';
- return ans;
- }
- void parse(string buf){
- string a=buf,tmp;
- int l=a.size();
- int k,j;
- transform(a.begin(),a.end(),a.begin(),::tolower);
- vector<pair<string,string> > ovo;
- string tmp1,tmp2;
- for(int i=0;i<a.size();i++){
- if(a[i] == ' '){ ovo.push_back(make_pair(tmp1,tmp2)); tmp1.clear(); tmp2.clear(); continue;}
- tmp1+=a[i];
- tmp2+=buf[i];
- }
- tmp1.erase(tmp1.length()-1);
- tmp2.erase(tmp2.length()-1);
- ovo.push_back(make_pair(tmp1,tmp2));
- l=ovo.size();
- for(int i=0;i<l-1;i++){
- if(ovo[i].first == "is" ){
- tmp1=ovo[i+1].first;
- tmp2=ovo[i+1].second;
- if(tmp1 == "a" || tmp1== "the")
- ovo[i+1].second = "no";
- else
- ovo.insert(ovo.begin()+i+1,make_pair("no","no"));
- voc.push_back(grab(ovo));
- if(tmp1 == "a" || tmp1== "the")
- ovo[i+1].second = "no";
- else
- ovo.erase(ovo.begin()+i+1);
- ovo[i+1].first = tmp1;
- ovo[i+1].second = tmp2;
- }
- if(ovo[i].first == "are" ){
- tmp1=ovo[i+1].first;
- tmp2=ovo[i+1].second;
- if(tmp1 == "a" || tmp1== "the")
- ovo[i+1].second = "no";
- else
- ovo.insert(ovo.begin()+i+1,make_pair("no","no"));
- voc.push_back(grab(ovo));
- if(tmp1 == "a" || tmp1== "the")
- ovo[i+1].second = "no";
- else
- ovo.erase(ovo.begin()+i+1);
- ovo[i+1].first = tmp1;
- ovo[i+1].second = tmp2;
- }
- if(ovo[i].first == "can" || ovo[i].first == "must" || ovo[i].first == "may" || ovo[i].first == "should" ){
- ovo.insert(ovo.begin()+i+1,make_pair("not","not"));
- voc.push_back(grab(ovo));
- ovo.erase(ovo.begin()+i+1);
- }
- }
- int i=l-1;
- if(ovo[i].first == "is" ){
- ovo.insert(ovo.begin()+i+1,make_pair("no","no"));
- voc.push_back(grab(ovo));
- ovo.erase(ovo.begin()+i+1);
- }
- if(ovo[i].first == "are" ){
- ovo.insert(ovo.begin()+i+1,make_pair("no","no"));
- voc.push_back(grab(ovo));
- ovo.erase(ovo.begin()+i+1);
- }
- if(ovo[i].first == "can" || ovo[i].first == "must" || ovo[i].first == "may" || ovo[i].first == "should" ){
- ovo.insert(ovo.begin()+i+1,make_pair("not","not"));
- voc.push_back(grab(ovo));
- ovo.erase(ovo.begin()+i+1);
- }
- }
- string trim(string s1){
- string s=s1;
- while(s[s.length()-1] == ' ') s.erase(s.end()-1);
- while(s[0] == ' ') s.erase(s.begin());
- return s;
- }
- int main(){
- freopen("m.in","r",stdin);freopen("m.out","w",stdout);
- //freopen("input.txt","r",stdin);
- //freopen("output.txt","w",stdout);
- //ofstream cout ("output.txt");
- string s;
- char c=90,l=90;
- while(c > 10){
- if(l=='.') l=getchar();
- c=getchar();
- if(l=='.' && c != ' ') break;
- s+=c;
- if(c == '.'){
- parse(s);
- //puts(s.c_str());
- s.clear();
- }
- l=c;
- }
- printf("%d\n",voc.size());
- for(int i=0;i<voc.size();i++)
- puts(trim(voc[i]).c_str());
- return 0;
- }
- //Одобрено Сумским Обласным Раввинатом. Кошерно.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement