CF 118A string task

来源:互联网 发布:软件认定企业查询 编辑:程序博客网 时间:2024/05/21 10:08

字符串水题;

之前的思路太过麻烦,后来想通了,如果满足约束条件直接跳过,否则输出就行了;

大概题意:

有一组字符串,如果不满足约束条件,每个字符前要有个 ‘ . ’ , 且大写要变为小写;

A. String Task
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

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 from1 to100, 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

AC代码:

#include <bits/stdc++.h>using namespace std ;char a[5000];bool check(char a){if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u'||a=='y'||a=='A'||a=='E'||a=='I'||a=='O'||a=='U'||a=='Y')return true;return false ;}int main(){scanf("%s",a);int len = strlen(a);for(int i = 0 ; i < len ; i++){if(check(a[i]))continue;else {if(a[i]>='A'&&a[i]<='Z')a[i]+=32;}printf(".%c",a[i]);}return 0 ;}


0 0
原创粉丝点击