Codeforce 118A String Task (字符串)No.2

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

output

.b.c.b


题目大意:

字符串处理

  • 只留辅音字母
  • 每个字母变小写
  • 每个辅音字母前面加”.”

做法:

  • 手写 tolowercase函数(大写字母和小写字母ASCII码差32)
  • “y”是半元音!!!!!!!!!!!!没去掉还能A到note15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
string s;
string tolowercase(string str){
for(int i=0;i<str.size();i++){
if(str[i]>='A'&&str[i]<='Z'){
str[i]+=32;
}
}
return str;
}
int main(){
cin>>s;
s=tolowercase(s);
for(int i=0;i<s.size();i++){
if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='y') continue;
else if(s[i]<='z'&&s[i]>='a'){
cout<<"."<<s[i];
}
}
cout<<endl;
return 0;
}

Powered by Hexo and Hexo-theme-hiker

Copyright © 2013 - 2018 Gilgamesh All Rights Reserved.

UV : | PV :