Remove Characters Adjacent to Vowels | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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 

23rd Jun 2018, 7:21 AM
OBULIRAJ S
OBULIRAJ S - avatar
3 Answers
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="")
7th Apr 2020, 2:27 PM
Deepa
- 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; }
23rd Jun 2018, 7:39 PM
VISHAL CHAUBEY Computer Science and Engineering
VISHAL CHAUBEY Computer Science and Engineering - avatar
- 1
hhhhhhhhhhhhhhooooooooooooooooooooooooowwwwwwwwwwwwwwwwwwwwtttttttttttttttooooooooooooooooooooosssssssssssssooooooooooooooooooolllllllllllllllllllllllvvvvvvvvvvvvvvvvvvvvvvvveeeeeeeeeeeeeeeeeeeeeeeeetttttttttttttttttttttttttthhhhhhhhhhhhhhhhhhhhhhhhhhhhhhheeeeeeeeeeeeeeeeeeeeeeeeeeeeppppppppppppppppppppppppppppppppppppppprrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrroooooooooooooooooooooooooooooooooooobbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbllllllllllllllllllllllllllllllllllllllllllllllllllllllllleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeemmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmhhhhhhhhhhhhhhooooooooooooooooooooooooowwwwwwwwwwwwwwwwwwwwtttttttttttttttooooooooooooooooooooosssssssssssssooooooooooooooooooolllllllllllllllllllllllvvvvvvvvvvvvvvvvvvvvvvvveeeeeeeeeeeeeeeeeeeeeeeeetttttttttttttttttttttttttthhhhhhhhhhhhhhhhhhhhhhhhhhhhhhheeeeeeeeeeeeeeeeeeeeeeeeeeeeppppppppppppppppppppppppppppppppppppppprrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrroooooooooooooooooooooooooooooooooooobbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbllllllllllllllllllllllllllllllllllllllllllllllllllllllllleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeemmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmhhhhhhhhhhhhhhooooooooooooooooooooooooowwwwwwwwwwwwwwwwwwwwtttttttttttttttooooooooooooooooooooosssssssssssssooooooooooooooooooolllllllllllllllllllllllvvvvvvvvvvvvvvvvvvvvvvvveeeeeeeeeeeeeeeeeeeeeeeeetttttttttttttttttttttttttthhhhhhhhhhhhhhhhhhhhhhhhhhhhhhheeeeeeeeeeeeeeeeeeeeeeeeeeeeppppppppppppppppppppppppppppppppppppppprrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrroooooooooooooooooooooooooooooooooooobbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbllllllllllllllllllllllllllllllllllllllllllllllllllllllllleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeemmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmhhhhhhhhhhhhhhooooooooooooooooooooooooowwwwwwwwwwwwwwwwwwwwtttttttttttttttooooooooooooooooooooosssssssssssssooooooooooooooooooolllllllllllllllllllllllvvvvvvvvvvvvvvvvvvvvvvvveeeeeeeeeeeeeeeeeeeeeeeeetttttttttttttttttttttttttthhhhhhhhhhhhhhhhhhhhhhhhhhhhhhheeeeeeeeeeeeeeeeeee
19th Feb 2019, 2:51 PM
Aniket