B - 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
解题思路:题目比较简单。要求删除给定字符串中出现的6个元音字母,输出的时候在每个辅音字母前面加一个字符'.',并且输出全部为小写。这里边判断边输出,水过。
AC代码:
#include <bits/stdc++.h>
using namespace std;
const char obj[]={'a','e','i','o','u','y'};
bool is_letter(char ch){
for(int i=;i<;++i)
if(ch==obj[i])return true;
return false;
}
int main()
{
char str[];
cin>>str;
for(int i=;str[i]!='\0';++i){
if(str[i]>='A'&&str[i]<='Z')str[i]+=;
if(!is_letter(str[i]))printf(".%c",str[i]);
}
cout<<endl;
return ;
}
B - String Task的更多相关文章
- codeforces水题100道 第二十二题 Codeforces Beta Round #89 (Div. 2) A. String Task (strings)
题目链接:http://www.codeforces.com/problemset/problem/118/A题意:字符串转换……C++代码: #include <string> #inc ...
- 多线程之任务: Task 基础, 多任务并行执行, 并行运算(Parallel)
Task - 基于线程池的任务(在 System.Threading.Tasks 命名空间下) 多 Task 的并行执行 Parallel - 并行计算(在 System.Threading.Task ...
- c# .Net并行和多线程编程之Task学习记录!
任务Task和线程Thread的区别: 1.任务是架构在线程之上的,也就是说任务最终还是要抛给线程去执行. 2.任务跟线程不是一对一的关系,比如开10个任务并不是说会开10个线程,这一点任务有点类似线 ...
- 5天玩转C#并行和多线程编程 —— 第三天 认识和使用Task
5天玩转C#并行和多线程编程系列文章目录 5天玩转C#并行和多线程编程 —— 第一天 认识Parallel 5天玩转C#并行和多线程编程 —— 第二天 并行集合和PLinq 5天玩转C#并行和多线程编 ...
- (Task)任务异步(TAP)的使用
任务有返回值例子: using System; using System.Collections.Generic; using System.Linq; using System.Text; usin ...
- Task使用小结
Task是.NET推出数据任务处理的工作类,Task的使用也被越来越多的人讲解,这里仅仅介绍Task的部分使用介绍: 1.Task简单创建 --无返回值 Task.Factory.StartNew(( ...
- Spring task executor同异步
1. spring提供了哪些任务执行器,是否有同步的任务执行器 有ThreadPoolTaskExecutor等执行器 同步可以用SyncTaskExecutor,但这个可以说不算一个线程池,因为还在 ...
- 关于Task类处理多线程简单示例
1.定义一个线程 var task1 = Task.Factory.StartNew(() => DoSomeWork()):方法如下: private static obje ...
- 重新想象 Windows 8 Store Apps (43) - 多线程之任务: Task 基础, 多任务并行执行, 并行运算(Parallel)
[源码下载] 重新想象 Windows 8 Store Apps (43) - 多线程之任务: Task 基础, 多任务并行执行, 并行运算(Parallel) 作者:webabcd 介绍重新想象 W ...
随机推荐
- 20190625 Oracle优化查询(一)
与其惴惴不安,不如定心应变 前提:我的Oracle服务器是安装在Windows环境中的,没有上到Linux 查看表结构 查询全表 查找空值, 使用“=”是没有结果的,应该使用IS NULL
- HDU 2414 Chessboard Dance(模拟题,仅此纪念我的堕落)
题目 模拟题也各种wa,我最近真的堕落了,,,,,智商越来越为负数了!!!!!!!! #include<stdio.h> #include<string.h> #include ...
- Codeforces Round #468 Div. 2题解
A. Friends Meeting time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- 第八节:numpy之四则运算与逻辑运算
- 基于JavaScript封装的Ajax工具类
前段是件由于工作需要无奈编写了一个给予JavaScript封装的工具类,技术有限,误喷,感谢大家的支持. 1.以下是JavaScript 的 Ajax 工具类. function createXMLH ...
- [UOJ#35] [UOJ后缀数组模板题] 后缀排序 [后缀数组模板]
后缀数组,解决字符串问题的有利工具,本题代码为倍增SA算法 具体解释详见2009年国家集训队论文 #include <iostream> #include <algorithm> ...
- RPC服务框架探索之Thrift
前言架构服务化后,需要实现一套方便调用各服务的框架,现在开源如日中天,优先会寻找开源实现,如果没有合适自家公司业务的,才会考虑从零开发,尤其是一切以KPI为准绳的公司,谁会跟钱过不去?N个月之前,公司 ...
- iptables防火墙原理详解+mysql pt工具
http://seanlook.com/2014/02/23/iptables-understand/
- HDU 5434
其实是一道状态DP题.都是行与行之间的转移,可以知道,当某j列中有一个象,如果存在情况i-1行j-1列有象而i,j-1位置无象则不可放,或者i-1,j+1有而i,j+1无同样不可放. 使用快速状态转移 ...
- HDU 2348
DFS+博弈. 假设存在两数(x,y),且x<y.对于(x+ky,y)k>=2,只能转移向两种状态(x+y,y),或者(x,y).而对于(x+y,y)只能向(x,y)转移,那么,可知,无论 ...