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 ...
随机推荐
- IE浏览器new Date()带参返回NaN解决方法
var start = '2016-01-01 12:12:12'; var date = new Date(start); 得到的时间为NaN: 解决方法: 1.自定义方法 自定义一个NewDate ...
- Python 不定长参数、全局变量、局部变量 day4
一.不定长参数 在函数定义中,经常会碰到*args 和**kwargs作为参数. 事实上在函数中,*和**才是必要的,args和kwargs可以用其他名称代替 *args 是指不定数量的非键值对参数. ...
- 关于static关键字的思考
静态方法是否能调用非静态成员变量? static关键字具有如下特点: 一.static关键字修饰的属性/方法可以通过类名直接调用,而不必先new一个对象. 二.sta ...
- 计蒜客 成绩统计 (Hash表)
链接 : Here! 思路 : 如果用 $STL$ 的 $map$ 或者是使用 $unordered\underline{}map$ 的话是会 $T$ 的, 所以得手写一个 $hash表$. 其实这个 ...
- cogs——49. 跳马问题
49. 跳马问题 水题 dfs裸基础 #include<cstdio> using namespace std; ]={,,,,}, ans,my[]={,-,,-,}; inline v ...
- [luogu4054 JSOI2009] 计数问题(2D BIT)
传送门 Solution 2D BIT模板 Code //By Menteur_Hxy #include <cmath> #include <cstdio> #include ...
- Python os.listdir() 方法
概述 os.listdir() 方法用于返回指定的文件夹包含的文件或文件夹的名字的列表.这个列表以字母顺序. 它不包括 '.' 和'..' 即使它在文件夹中. 只支持在 Unix, Windows 下 ...
- BZOJ 1602 USACO 2008 Oct. 牧场行走
[题解] 要求出树上两点间的距离,树上的边有边权,本来应该是个LCA. 看他数据小,Xjb水过去了...其实也算是LCA吧,一个O(n)的LCA... #include<cstdio> # ...
- PAT 1103 Integer Factorization
The K-P factorization of a positive integer N is to write N as the sum of the P-th power of K positi ...
- max_element()与min_element()
#include<iostream>#include<algorithm>using namespace std;bool cmp(int i,int j){ return i ...