Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <cstring>
- #include<cmath>
- using namespace std;
- int main()
- {
- char s[260],a[30],b[260],v[102][260];
- int i,j,n,ok,okp,p=0,x=0,y=0;
- ifstream in("fraze.in");
- ofstream out("fraze.out");
- a[0]='a';
- for(i=1;i<=25;i++)
- a[i]=a[i-1]+1;
- while(in.getline(s,260,'\n'))
- {
- strcpy(b,s);
- for (i=0;i<strlen(b);i++)
- if (b[i]>='A'&&b[i]<='Z') b[i]+=32;
- ok=1;
- okp=1;
- for(i=0;i<=25;i++)
- {
- p=0;
- for(j=0;j<=strlen(b)-1;j++)
- {
- if(a[i]==b[j])
- p++;
- if(p>2)
- break;
- }
- if(p==0)
- {
- ok=0;
- okp=0;
- }
- if(p>1)
- okp=0;
- }
- if(ok==1)
- {
- x++;
- for(i=0;i<=strlen(b);i++)
- v[x][i]=s[i];
- }
- if(okp==1)
- y++;
- }
- out<<x<<' '<<y<<'\n';
- do
- {
- ok=1;
- for(i=1;i<x;i++)
- if(strcmp(v[i],v[i+1])>0)
- {
- ok=0;
- strcpy(b,v[i]);
- strcpy(v[i],v[i+1]);
- strcpy(v[i+1],b);
- }
- }while(ok==0);
- for(i=1;i<=x;i++)
- out<<v[i]<<'\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement