zoukankan      html  css  js  c++  java
  • 2017.10.31

    题目描述

    给定一个英文字符串,请写一段代码找出这个字符串中首先出现三次的那个英文字符。

    输入描述:

    输入数据一个字符串,包括字母,数字等。

    输出描述:

    输出首先出现三次的那个英文字符
    示例1

    输入

    Have you ever gone shopping and
    

    输出

    e


    程序来自网上,侵权即删。

    #include <iostream>
    #include <stdio.h>
    #include <math.h>
    #include <iomanip> //不能写成#include <iomanip.h>
    #include <string.h>

    using namespace std;

    /* run this program using the console pauser or add your own getch, system("pause") or input loop */
    #include<stdio.h>
    #include<string.h>

    int main()
    {
    char c;
    int a[300]={0};
    while((c=getchar()) != EOF)
    {
    if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
    {
    a[c]++;

    if(a[c] == 3)
    {
    printf("%c",c);
    break;
    }

    }
    }
    return 0;
    }

  • 相关阅读:
    tcp socket http(复制的)
    cas php
    占用字节
    网络基础
    Mbps MB/S Mb/s
    path_info和get_full_path()的区别
    rbac权限管理
    ORM _meta
    Django SQLite3的使用
    url的分发
  • 原文地址:https://www.cnblogs.com/panlangen/p/7764289.html
Copyright © 2011-2022 走看看