Codeforces 118A String Task

题目链接

http://codeforces.com/problemset/problem/118/A

#include<iostream>
#include<string>
#include<cctype>
#include<algorithm>
using namespace std;

int main()
{
    string str;
    cin>>str;

    int i;
    //将代码变成小写
    transform(str.begin(), str.end(), str.begin(), ::tolower);
    //移除特定的字符串
    str.erase(std::remove(str.begin(), str.end(), ‘a‘), str.end());
    str.erase(std::remove(str.begin(), str.end(), ‘e‘), str.end());
    str.erase(std::remove(str.begin(), str.end(), ‘i‘), str.end());
    str.erase(std::remove(str.begin(), str.end(), ‘o‘), str.end());
    str.erase(std::remove(str.begin(), str.end(), ‘u‘), str.end());
    str.erase(std::remove(str.begin(), str.end(), ‘y‘), str.end());
    int len=str.length();
    for(i=0;i<len;i++)
    {

            cout<<"."<<str[i];
    }

    return 0;
}

原文地址:https://www.cnblogs.com/CMlhc/p/9194056.html

时间: 2024-07-30 14:10:00

Codeforces 118A 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> #include <iostream> using namespace std; string s; bool _in(char c, string s) { for (int i =0 ; i < s.length(); i ++) if (c == s[i]) return true; retu

2776. String Task

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 vowel

CodeForces 159c String Manipulation 1.0

String Manipulation 1.0 Time Limit: 3000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 159C64-bit integer IO format: %I64d      Java class name: (Any) One popular website developed an unusual username editing proced

codeforces 558EA Simple Task

开始试想直接用容器来暴力做,,,,,, 恩.....线段树.... 记不得以前写没写过了,,,, 先来个模板先(就是那种n个询问成段更新的题) #include<stdio.h> #include<string.h> #include <algorithm> #include <bits/stdc++.h> using namespace std; #define lson l , m , rt << 1 #define rson m + 1 ,

Codeforces C - String Reconstruction

C - String Reconstruction 方法一:把确定的点的父亲节点设为下一个点,这样访问过的点的根节点都是没访问过的点. 代码: #include<bits/stdc++.h> using namespace std; const int N=1e6+5; char s[N],res[N*2]; int fa[N*2]; int Find(int x) { return x==fa[x]?x:fa[x]=Find(fa[x]); } int main() { for(int i=

CodeForces 828C String Reconstruction(并查集思想)

题意:给你n个串,给你每个串在总串中开始的每个位置,问你最小字典序总串. 思路:显然这道题有很多重复填涂的地方,那么这里的时间花费就会特别高. 我们维护一个并查集fa,用fa[i]记录从第i位置开始第一个没填涂的位置,那每次都能跳过涂过的地方.每次填完当前格就去填find(fa[i + 1]). ps:一定要合并,不然超时. 代码: #include<stack> #include<vector> #include<queue> #include<set>

Codeforces 653F Paper task SA

Paper task 如果不要求本质不同直接st表二分找出最右端, 然后计数就好了. 要求本质不同, 先求个sa, 然后用lcp求本质不同就好啦. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #define PII

Codeforces 1296E2 - String Coloring (hard version)

题目大意: 给定一段长度为n的字符串s 你需要给每个字符进行涂色,然后相邻的不同色的字符可以进行交换 需要保证涂色后能通过相邻交换把这个字符串按照字典序排序(a~z) 你可以使用无限种颜色,但是要保证用到的颜色种类最少 从1开始对颜色进行编号,先输出最少使用的颜色种类,再给出涂色方案 解题思路 1: 可以引入一个 r 数组,开26个空间代表26种字母 这个数组 r[i] 的值代表 第 i 个字母在前面涂的颜色最大编号是多少,0表示没出现过 遍历这个字符串,再从当前字母后一个位置开始往后再遍历这个

Codeforces 828C String Reconstruction【并查集巧妙运用】

LINK 题目大意 给你n个串和在原串中的出现位置,问原串 思路 直接跑肯定是GG 考虑怎么优化 因为保证有解,所以考虑过的点我们就不再考虑 用并查集维护当前每个点之后最早的没有被更新过的点 然后就做完了,很巧妙对吧 c++//Author: dream_maker #include<bits/stdc++.h> using namespace std; //---------------------------------------------- //typename typedef lo