- 1
Remove Characters Adjacent to Vowels
Boundary Condition(s): 1 <= Length of String <= 1000 Input Format: The first line contains the string. Output Format: The first line contains the string with the characters adjacent to vowels removed from it. Example Input/Output 1: Input: thinker Output: tie Example Input/Output 2: Input: table Output: ae C
4 Respostas
0
s=input().strip()
for i in range(len(s)):
if i==0:
if s[i+1] not in "aeiouAEIOU":
print(s[i],end="")
elif i==len(s)-1:
if s[i-1] not in "aeiouAEIOU":
else:
if not (s[i+1] in "aeiouAEIOU" or s[i-1] in "aeiouAEIOU":
print(s[i],end="")
- 1
#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
string s,k;
cin>>s;
int x=s.length();
int j,i;
for(j=0;j<x;j++)
{
if((s[j]=='a') || (s[j]=='e') || (s[j]=='i') || (s[j]=='o') ||(s[j]=='u'))
{
s[j-1]='#';
s[j+1]='#';
}
}
for(i=0;i<x;i++)
{
if(s[i]!='#')
k+=s[i];
}
cout<<k;
return 0;
}
- 1
hhhhhhhhhhhhhhooooooooooooooooooooooooowwwwwwwwwwwwwwwwwwwwtttttttttttttttooooooooooooooooooooosssssssssssssooooooooooooooooooolllllllllllllllllllllllvvvvvvvvvvvvvvvvvvvvvvvveeeeeeeeeeeeeeeeeeeeeeeeetttttttttttttttttttttttttthhhhhhhhhhhhhhhhhhhhhhhhhhhhhhheeeeeeeeeeeeeeeeeeeeeeeeeeeeppppppppppppppppppppppppppppppppppppppprrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrroooooooooooooooooooooooooooooooooooobbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbllllllllllllllllllllllllllllllllllllllllllllllllllllllllleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeemmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmhhhhhhhhhhhhhhooooooooooooooooooooooooowwwwwwwwwwwwwwwwwwwwtttttttttttttttooooooooooooooooooooosssssssssssssooooooooooooooooooolllllllllllllllllllllllvvvvvvvvvvvvvvvvvvvvvvvveeeeeeeeeeeeeeeeeeeeeeeeetttttttttttttttttttttttttthhhhhhhhhhhhhhhhhhhhhhhhhhhhhhheeeeeeeeeeeeeeeeeeeeeeeeeeeeppppppppppppppppppppppppppppppppppppppprrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrroooooooooooooooooooooooooooooooooooobbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbllllllllllllllllllllllllllllllllllllllllllllllllllllllllleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeemmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmhhhhhhhhhhhhhhooooooooooooooooooooooooowwwwwwwwwwwwwwwwwwwwtttttttttttttttooooooooooooooooooooosssssssssssssooooooooooooooooooolllllllllllllllllllllllvvvvvvvvvvvvvvvvvvvvvvvveeeeeeeeeeeeeeeeeeeeeeeeetttttttttttttttttttttttttthhhhhhhhhhhhhhhhhhhhhhhhhhhhhhheeeeeeeeeeeeeeeeeeeeeeeeeeeeppppppppppppppppppppppppppppppppppppppprrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrroooooooooooooooooooooooooooooooooooobbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbllllllllllllllllllllllllllllllllllllllllllllllllllllllllleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeemmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmhhhhhhhhhhhhhhooooooooooooooooooooooooowwwwwwwwwwwwwwwwwwwwtttttttttttttttooooooooooooooooooooosssssssssssssooooooooooooooooooolllllllllllllllllllllllvvvvvvvvvvvvvvvvvvvvvvvveeeeeeeeeeeeeeeeeeeeeeeeetttttttttttttttttttttttttthhhhhhhhhhhhhhhhhhhhhhhhhhhhhhheeeeeeeeeeeeeeeeeee