Advertisement
a53

Intersectie_Multimi

a53
Oct 27th, 2019
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #include <iostream>
  2. #define Nmax 150
  3. using namespace std;
  4. string N[Nmax],Z[Nmax],Q[Nmax],R[Nmax];
  5. int f[Nmax];
  6.  
  7. int main()
  8. {
  9. int n,cnt1=0,cnt2=0,cnt3=0,cnt4=0;
  10. string c;
  11. cin>>n;
  12. for(int i=1;i<=n;++i)
  13. {
  14. cin>>c;
  15. for(unsigned int j=0;j<c.size();++j)
  16. ++f[(int)(c[j])];
  17. if(f[(int)('.')]==0)
  18. if(f[(int)('-')]==0)
  19. ++cnt1,N[cnt1]=c,++cnt2,Z[cnt2]=c,++cnt3,Q[cnt3]=c;
  20. else
  21. ++cnt2,Z[cnt2]=c,++cnt3,Q[cnt3]=c;
  22. else
  23. if(f[int('.')]==1)
  24. ++cnt3,Q[cnt3]=c;
  25. else
  26. ++cnt4,R[cnt4]=c;
  27. for(int j=0;j<150;++j)
  28. f[j]=0;
  29. }
  30. if(cnt1==0)
  31. cout<<"Multime vida";
  32. else
  33. for(int i=1;i<=cnt1;++i)
  34. cout<<N[i]<<' ';
  35. cout<<'\n';
  36. if(cnt2==0)
  37. cout<<"Multime vida";
  38. else
  39. for(int i=1;i<=cnt2;i++)
  40. cout<<Z[i]<<' ';
  41. cout<<'\n';
  42. if(cnt3==0)
  43. cout<<"Multime vida";
  44. else
  45. for(int i=1;i<=cnt3;++i)
  46. cout<<Q[i]<<' ';
  47. cout<<'\n';
  48. if(cnt4==0)
  49. cout<<"Multime vida";
  50. else
  51. for(int i=1;i<=cnt4;++i)
  52. cout<<R[i]<<' ';
  53. return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement