118A - 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:

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 from 1 to 100, inclusive.
Output
Print the resulting string. It is guaranteed that this string is not empty.
Example
Input
tour
Output
.t.r
Input
Codeforces
Output
.c.d.f.r.c.s
Input
aBAcAba
Output
.b.c.b
题目大意:给定一个字符串,不显示其中的元音字母,辅音字母前面加'.'输出

#include 
#include 
#define MAX 100

int main()
{

    char str[MAX];
    int len,i=0;
    //printf("Input\n");
    scanf("%s",str);
    //printf("Output\n");
    for (int i = 0; str[i]!='\0'; i++){
        if (str[i]>='A'&&str[i]<='Z')
        {
            str[i]=str[i]+32; //大小写转换

        }
        if (str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u'||str[i]=='y')
        {
            str[i]=-1; //这里做一个假删除
        }
        if (str[i]!=-1)
        {
            printf(".");
            printf("%c",str[i]);
        }

    }

    printf("\n");
    return 0;

}

其中两行print是不需要的,加上通过不了。所以注释掉了

你可能感兴趣的:(118A - String Task)