我是靠谱客的博主 繁荣银耳汤,最近开发中收集的这篇文章主要介绍第一期 第一题,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

String Task

Problem Description
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.

Examples
Input
tour
Output
.t.r
Input
Codeforces
Output
.c.d.f.r.c.s
Input
aBAcAba
Output
.b.c.b

问题链接:https://vjudge.net/problem/CodeForces-118A

问题简述:输入一串字符,将所有大写字母转换为小写输出,删除所有元音字母,并在每个字母前加上‘.’。

问题分析:先将所有字母转换成小写,将非元音字母输出。

程序说明:利用ASCII码将大小写进行转换,用if语句判断是否为元音字母,将不是元音字母的字母字符进行输出。

AC通过的C语言程序如下:
#include <stdio.h>
int main()
{
char ch;
scanf("%c",&ch);
while (ch != ‘n’)
{
if (ch >= 65 && ch <= 90)
{
ch = ch + 32;
}
if (ch != ‘a’ && ch != ‘o’ && ch != ‘y’ && ch != ‘e’ && ch != ‘u’ && ch != ‘i’)
{
printf(".%c", ch);
}
scanf("%c", &ch);
}
}

最后

以上就是繁荣银耳汤为你收集整理的第一期 第一题的全部内容,希望文章能够帮你解决第一期 第一题所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(42)

评论列表共有 0 条评论

立即
投稿
返回
顶部