Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- ifstream f("date.in");
- ofstream g("date.out");
- int nrvoc(char s[])
- {
- int c=0;
- for(int i=0;i<strlen(s);++i){
- if(strchr("AEIOUaeiou",s[i]))c++;
- }
- return c;
- }
- int main()
- {
- int c=0;
- char s[256];
- char cuv[140][256];
- f.get(s,255);
- char *p=strtok(s," ");
- char vex[255];
- while(p){
- c++;
- strcpy(cuv[c],p);
- strcpy(vex,p);
- p=strtok(nullptr," ");
- }
- for(int i=1;i<=c;++i){
- for(int j=i+1;j<=c;++j){
- if(strcmp(cuv[i],cuv[j])>0){
- char aux[255];
- strcpy(aux,cuv[i]);
- strcpy(cuv[i],cuv[j]);
- strcpy(cuv[j],aux);
- }
- }
- }
- for(int i=1;i<=c;++i)
- g<<cuv[i]<<endl;
- char maxvoc[255];
- strcpy(maxvoc,cuv[1]);
- for(int i=2;i<=c;++i){
- if(nrvoc(maxvoc)<nrvoc(cuv[i])){
- strcpy(maxvoc,cuv[i]);
- }
- if(nrvoc(maxvoc)==nrvoc(cuv[i])){
- if(strlen(cuv[i])<strlen(maxvoc))
- strcpy(maxvoc,cuv[i]);
- }
- }
- g<<endl<<maxvoc<<endl;
- int nr=0;
- for(int i=1;i<=c;++i){
- if(nrvoc(cuv[i])>strlen(cuv[i])-nrvoc(cuv[i]))
- nr++;
- }
- g<<nr<<endl;
- for(int i=1;i<strlen(vex);++i){
- for(int j=i;j<strlen(vex);++j)
- g<<vex[j]; ///vex e ultimul cuvant
- g<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement