Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- ifstream fin("perechivocale1.in");
- ofstream fout("perechivocale1.out");
- bool vocal(char c){
- return c=='a'||c=='e'||c=='i'||c=='o'||c=='u';}
- struct pe {
- char pr;
- char doi;
- };
- char c[43];
- int t,fr[30][30],maxx;
- pe per[30];
- void citire(){
- while(!fin.eof()){c[0]='\0';
- fin>>c;
- for(int i=0;c[i+1];i++)
- if(vocal(c[i]) and vocal(c[i+1]))
- {
- int x= c[i]-'a';
- int y= c[i+1]-'a';
- fr[x][y]++;
- if(fr[x][y]>maxx)
- {
- maxx=fr[x][y];
- t=1;
- per[t].pr=c[i];
- per[t].doi=c[i+1];
- }
- else
- if(fr[x][y]==maxx){
- cout<<c<<" ";
- per[++t].pr=c[i];
- per[t].doi=c[i+1];
- }
- }
- }
- }
- void afisare(){
- if(!t)
- fout<<"NU";
- else
- for(int i=1;i<=t;i++)
- fout<<per[i].pr<<per[i].doi<<" ";
- }
- int main()
- {
- citire();
- afisare();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement