zoukankan      html  css  js  c++  java
  • Let the Balloon Rise (STL)

    Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color and find the result.

    This year, they decide to leave this lovely job to you.


    Input

    Input contains multiple test cases. Each test case starts with a number N (0 < N < 1000) -- the total number of balloons distributed. The next N lines contain one color each. The color of a balloon is a string of up to 15 lower-case letters.

    A test case with N = 0 terminates the input and this test case is not to be processed.


    <b< dd="">

    Output

    For each case, print the color of balloon for the most popular problem on a single line. It is guaranteed that there is a unique solution for each test case.


    <b< dd="">

    Sample Input

    5
    green
    red
    blue
    red
    red
    3
    pink
    orange
    pink
    0


    <b< dd="">

    Sample Output

    red
    pink

    #include <bits/stdc++.h>
    using namespace std;
    const int maxn = 1e6+10;
    const int INF =0x3f3f3f3f;
    //#define LOCAL
    #define FOR(i,start,end) for(int i=start;i<=end;i++)
    #define FOR_(i,end,start) for(int i=end;i>=start;i--)
    #define TLE ios::sync_with_stdio(false)
    #define cc cout<<
    typedef long long ll;
    typedef struct node
    {
        char ch;
        struct node *l,*r;
    } node , *link;
    node no[60];
    string s1,s2;
    int j=0;
    void  creat(int st , int en)
    {
        int i;
        if(st>en) return ;
        for(i=0;i<en;i++)
            if(s2[i]==s1[j])
                break;
        j++;
        creat(st,i-1);
        creat (i+1,en);
        cout<<s2[i];
    }
    
    int main()
    {
        while(cin>>s1>>s2)
        {
            j=0;
            creat( 0,s2.length()-1 );
            cc  endl;
        }
    }
    所遇皆星河
  • 相关阅读:
    正则去掉 html标签
    app内嵌 h5页面 再滑动的时候 触发击穿底下的一些touchstart事件
    设置按钮不能连续点击并触发点击事件
    使用NPOI导入导出标准Excel
    ASP.NET导出word实例
    常用SQL语句大全总结
    判断以及防止SQL注入
    javascript 正则表达式总结
    前端页面优化技巧
    自我介绍
  • 原文地址:https://www.cnblogs.com/Shallow-dream/p/11632224.html
Copyright © 2011-2022 走看看