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;
        }
    }
    所遇皆星河
  • 相关阅读:
    生成lua的静态库.动态库.lua.exe和luac.exe
    Eclipse 常用快捷键 (动画讲解)
    Lua table之弱引用
    编程语言简史(转)
    sublime text 下的Markdown写作
    使用python拼接多张图片.二三事
    Lua标准库- 模块(Modules)
    lua的私有性(privacy)
    Lua字符串库(整理)
    字符编码的故事(转)
  • 原文地址:https://www.cnblogs.com/Shallow-dream/p/11632224.html
Copyright © 2011-2022 走看看