栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

CodeForces - 118A String Task

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

CodeForces - 118A String Task

A. String Task
time limit per test2 seconds
memory limit per test256 megabytes

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

问题链接:CodeForces - 118A String Task
问题简述:(略)
问题分析:(略)
AC的C++语言程序如下:


#include 
#include 
#include 

#define N 100
char a[N +1];

int judge(char c)
{
    return c == 'A' || c == 'a' || c == 'E' || c == 'e' ||
            c == 'I' || c == 'i' || c == 'O' || c == 'o' ||
            c == 'U' || c == 'u' || c == 'Y' || c == 'y';
}

int main()
{
    int i;
    scanf("%s", a);
    for (i = 0; a[i]; i++) {
        if (judge(a[i])) continue;
        putchar('.');
        putchar(isupper(a[i]) ? tolower(a[i]) : a[i]);
    }

    return 0;
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/779221.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号