String Task
Time limit 2000ms
Memory limit 262144kb
Problem Description
Petya need to write a program which was supposed to do the following: in the given string, consisting if uppercase and lowercase Latin letters, it:
1.deletes all the vowels,
2.inserts a character “.” before each consonant,
3.replaces all uppercase consonants with corresponding lowercase ones.
Vowels are letters “A”, “O”, “Y”, “E”, “U”, “I”, and the rest are consonants.
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.
Sample Input
Codeforces
Sample Output
.c.d.f.r.c.s
Source Problem Link:
https://vjudge.net/problem/CodeForces-118A
解题代码:
#include <iostream>
using namespace std;
int main(void)
{
char temp, array[201];
int count, i;
count = i = 0;
while(1)
{
temp = cin.get();
if(temp != '\n')
{
count++;
if(count < 1 || count > 100)
{
break;
}
if(temp >= 'A' && temp <= 'Z')
{
temp += 32;
}
switch(temp)
{
case 'a':
case 'o':
case 'y':
case 'e':
case 'u':
case 'i':
continue;
}
array[i] = '.';
array[i + 1] = temp;
i += 2;
}
else
{
array[i] = '\0';
cout << array;
break;
}
}
return 0;
}