String Task

Petya started to attend programming lessons. On the first lesson his task was to write a simple program. The program was supposed to do the following: in the given string, consisting if uppercase and lowercase Latin letters, it:

deletes all the vowels,
inserts a character “.” before each consonant,
replaces all uppercase consonants with corresponding lowercase ones.
Vowels are letters “A”, “O”, “Y”, “E”, “U”, “I”, and the rest are consonants. The program’s input is exactly one string, it should return the output as a single string, resulting after the program’s processing the initial string.

Help Petya cope with this easy task.

Input
The first line represents input string of Petya’s program. This string only consists of uppercase and lowercase Latin letters and its length is from 1 to 100, inclusive.

Output
Print the resulting string. It is guaranteed that this string is not empty.

Examples

Input
tour

Output
.t.r

Input
Codeforces

Output
.c.d.f.r.c.s

Input
aBAcAba

扫描二维码关注公众号,回复: 4442962 查看本文章

Output
.b.c.b

题解:就是讲元音的几个字母跳过然后把大写的字母转换成小写的…我认为首先把所有大小写字母转换后再用条件语句将非元音字母输出就行了这样可以省略对元音大写字母的挑选

我的代码:

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define maxn 105
int main()
{
char a[maxn];
while(cin>>a)
{
for(int i=0;i<strlen(a);i++)
{
if(a[i]>=65&&a[i]<=90) a[i]=a[i]+32;
if(a[i]!='a'&&a[i]!='e'&&a[i]!='i'&&a[i]!='o'&&a[i]!='u'&&a[i]!='y')
cout<<"."<<a[i];
}
}
return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_43866317/article/details/84887556
今日推荐