codeforce118A String Task
阿新 • • 發佈:2018-12-01
A. String Task
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Examples
input
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 ".
- 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.
touroutput
.t.rinput
Codeforcesoutput
.c.d.f.r.c.sinput
aBAcAbaoutput
.b.c.b
/*codeforce118A - String Task*/
#include <stdio.h>
#define size 120
#include <string.h>
void change(char ar[], int len);
int main(void)
{
char ori[size] = { '\0' };
int len = 0;
scanf("%s", ori);
len = strlen(ori);
change(ori, len);
for (int i = 0; i < len; i++)
{
if (ori[i] == ' ')
{
continue;
}
printf(".%c", ori[i]);
}
return 0;
}
void change(char ar[], int len)
{
for (int i = 0; i < len; i++)
{
if (ar[i] == 'A' || ar[i] == 'O' || ar[i] == 'Y' || ar[i] == 'E' || ar[i] == 'U' || ar[i] == 'I')
{
ar[i] = ' ';
}
if (ar[i] == 'a' || ar[i] == 'o' || ar[i] == 'y' || ar[i] == 'e' || ar[i] == 'u' || ar[i] == 'i')
{
ar[i] = ' ';
}
ar[i] = tolower(ar[i]);
}
}