CF 118A string task
来源:互联网 发布:软件认定企业查询 编辑:程序博客网 时间:2024/05/21 10:08
字符串水题;
之前的思路太过麻烦,后来想通了,如果满足约束条件直接跳过,否则输出就行了;
大概题意:
有一组字符串,如果不满足约束条件,每个字符前要有个 ‘ . ’ , 且大写要变为小写;
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.
The first line represents input string of Petya's program. This string only consists of uppercase and lowercase Latin letters and its length is from1 to100, inclusive.
Print the resulting string. It is guaranteed that this string is not empty.
tour
.t.r
Codeforces
.c.d.f.r.c.s
aBAcAba
.b.c.b
AC代码:
#include <bits/stdc++.h>using namespace std ;char a[5000];bool check(char a){if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u'||a=='y'||a=='A'||a=='E'||a=='I'||a=='O'||a=='U'||a=='Y')return true;return false ;}int main(){scanf("%s",a);int len = strlen(a);for(int i = 0 ; i < len ; i++){if(check(a[i]))continue;else {if(a[i]>='A'&&a[i]<='Z')a[i]+=32;}printf(".%c",a[i]);}return 0 ;}
- CF - 118A - String Task
- CF: 118A.String Task
- CF 118A string task
- 118A - String Task
- 118A String Task
- CodeForces 118A. String Task
- codeforces 118A String Task
- Problem--118A--Codeforces--String Task
- CodeForces 118 A.String Task(水~)
- A. String Task
- 【CodeForces】A. String Task
- CF 11D A Simple Task
- 【CF】【312div2】【A Simple Task】
- CF:219A. k-String
- codeforces 118A String Task(字符串水题)
- CF 558E(A Simple Task-计数排序+线段树)
- CF 558E A Simple Task(多维线段树)
- cf #312 E. A Simple Task (线段树+计数排序)
- Git常用命令
- UVA 673 Parentheses Balance
- 1465 不容易系列之一
- java中基本输入输出流的解释
- java.toString() ,(String),String.valueOf的区别
- CF 118A string task
- Linux Mint下的Tomcat安装及配置
- 模态从第三个控制器返回到第一个控制器
- Leet Code OJ 202. Happy Number [Difficulty: Easy]
- 在VMWare安装Xinu
- 傻瓜学算法系列之排序——3.选择排序
- Android 自定义RecyclerView 实现真正的Gallery效果
- java 用嵌套for循环实现九九乘法表各种形状的展现
- UVA 712 S-Trees