118A. String Task

118A. String Task

  • time limit per test2 seconds
  • memory limit per test256 megabytes
  • inputstandard input
  • outputstandard 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.

元音是字母“A”、“O”、“Y”、“E”、“U”、“I”,其余是辅音。程序的输入正好是一个字符串,它应该以单个字符串的形式返回输出,在程序处理初始字符串后产生。

Help Petya cope with this easy task.

帮助Petya完成这个简单的任务。

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.

第一行代表Petya程序的输入字符串。该字符串仅由大写和小写拉丁字母组成,长度为1到100(含1到100)。

Output

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

打印结果字符串。可以保证这个字符串不是空的。

Examples
input1

tour

output1

.t.r

input2

Codeforces

output2

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

input3

aBAcAba

output3

.b.c.b

Solution

判断字母是否为元音还是以ASCII码为标准进行

Code
#include <iostream>
using namespace std;

//118A. String Task
#include<cctype>
int main() {
    string a;
    cin >> a;
    int len = a.size();
    int ia = 0;
    for(int i = 0;i < len;i++){
        ia=(a[i] - 'A') % 32;
        if(ia != 0 && ia != 4 && ia != 8 && ia !=14 && ia != 20 && ia != 24){//不为元音a、e、i、o、u、y
            if(isupper(a[i])){
                a[i] = tolower(a[i]);
            }
            cout<<"."<<a[i];
        }
    }
    cout << endl;
    return 0;
}