Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. using namespace std;
  5. ifstream fin("perechivocale1.in");
  6. ofstream fout("perechivocale1.out");
  7.  
  8. bool vocal(char c){
  9. return c=='a'||c=='e'||c=='i'||c=='o'||c=='u';}
  10. struct pe {
  11. char pr;
  12. char doi;
  13. };
  14. char c[43];
  15. int t,fr[30][30],maxx;
  16. pe per[30];
  17. void citire(){
  18. while(!fin.eof()){c[0]='\0';
  19. fin>>c;
  20. for(int i=0;c[i+1];i++)
  21. if(vocal(c[i]) and vocal(c[i+1]))
  22. {
  23. int x= c[i]-'a';
  24. int y= c[i+1]-'a';
  25. fr[x][y]++;
  26. if(fr[x][y]>maxx)
  27. {
  28. maxx=fr[x][y];
  29. t=1;
  30. per[t].pr=c[i];
  31. per[t].doi=c[i+1];
  32. }
  33. else
  34. if(fr[x][y]==maxx){
  35. cout<<c<<" ";
  36. per[++t].pr=c[i];
  37. per[t].doi=c[i+1];
  38. }
  39.  
  40. }
  41. }
  42. }
  43. void afisare(){
  44. if(!t)
  45. fout<<"NU";
  46. else
  47. for(int i=1;i<=t;i++)
  48. fout<<per[i].pr<<per[i].doi<<" ";
  49. }
  50. int main()
  51. {
  52. citire();
  53. afisare();
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement