codeforces118/A
A. 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:
SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。- 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.
InputThe 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.
OutputPrint the resulting string. It is guaranteed that this string is not empty.
Examples inputtouroutput
.t.rinput
Codeforces output
.c.d.f.r.c.sinput
aBAcAbaoutput
.b.c.b
题解:先变成小写,然后是元音不处理,是辅音就输出.+辅音 注意y也是元音
#include<iostream> #include<string> #include<cstring> using namespace std; typedef long long ll; int main() { string s; cin>>s; for(int i=0;i<s.length();i++) if(s[i]>='A'&&s[i]<='Z') s[i]+=32; for(int i=0;i<s.length();i++) { if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='y') continue; else cout<<"."<<s[i]; } return 0; }
