Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int vocala(char x)
- {
- return (x=='a'||x=='e'||x=='i'||x=='o'||x=='u'||x=='A'||x=='E'||x=='I'||x=='O'||x=='U'); //verifica dc e vocala
- }
- int main()
- {
- char s[256];
- cin.get(s,256);
- int nv=0;
- unsigned int L=strlen(s),i=L-1;
- unsigned int j=0;
- while(vocala(s[j])&&j<=L)
- {
- nv++;
- j++;
- }
- if(nv>1)
- {
- for(unsigned int j=0;j<=L-nv+2;j++)
- s[j]=s[j+nv];
- s[L-nv+1]='\0';
- L-=nv;
- i=L-1;
- }
- while(i>0)
- {
- nv=0;
- while(vocala(s[i])&&i>0)
- {
- nv++;
- i--;
- }
- if(nv>1)
- {
- i++;
- for(unsigned int j=i;j<=L-nv+2;j++)
- s[j]=s[j+nv];
- s[L-nv+1]='\0';
- L-=nv;
- }
- else
- if(nv==1)
- i++;
- i--;
- }
- if(L==1&&vocala(s[0]))
- {
- return 0;
- }
- cout<<s;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement