zoukankan      html  css  js  c++  java
  • "尚学堂杯"哈尔滨理工大学第七届程序设计竞赛 F Final Ugly English

    F.Final Ugly English
    Time Limit: 1000 MS Memory Limit: 32768 K
    Total Submit: 2074(405 users) Total Accepted: 294(291 users) Special Judge: No
    Description

    ACM twist-toy encountered such a problem in the work,

     this article, to ensure that this article 

    only lowercase letters 

    and spaces, please send the articles in each 

    word inverted output, such as "hello world this is

     an competition". You 

    should output "olleh dlrow siht si na noititepmoc".

    Input

    A group of data, each line of data input from the 

    lower case letters and spaces of the article,

     the length of not more than

     one thousand

    Output
    Output a line for each word after the reversal of the article.
    Sample Input
    hello world this is an competition
    Sample Output
    olleh dlrow siht si na noititepmoc


    一遇到这种题就gg了,大哭,一定得好好补补这种题型

    注意:1。多组输入。2.输出后得字符串无空格

    #include<stdio.h>
    #include<string.h>
    #include<iostream>
    #include<algorithm>
    using namespace std;
    string a;
    /ar b[1005];
    int main()
    {
        while(getline(cin,a))
        {
            int len=a.size();
            //printf("%d
    ",len);
            int j=0,k=0;
            for(int i=0; i<=len; i++)
            {
                //printf("%d
    ",a[i]);
                if(a[i]<'a'||a[i]>'z')
                {
                    //printf("%d 
    ",i);
                    for(j=i-1; j>=k; j--)
                    {
                        printf("%c",a[j]);
                    }
                    k=i+1;
                    if(i<len)
                        printf(" ");
                }
            }
            printf("
    ");
        }
        return 0;
    }
    







  • 相关阅读:
    fastadmin表单弹窗按钮显示为数据库数据
    fastadmin根据栏目获取全部文章
    关于Ubuntu系统的音频录制和播放以及bug解决
    GCC、G++升级
    Install protoc3(Protobuf)
    java学习day12--类与类之间的关系
    java学习day11--接口
    java学习day11--抽象类
    java面试基础题2
    java学习day10--final关键字
  • 原文地址:https://www.cnblogs.com/zxy160/p/7215131.html
Copyright © 2011-2022 走看看