uva-10815

来源:互联网 发布:javascript outlook 编辑:程序博客网 时间:2024/06/07 00:48
奶奶的,过了,这么水的提,我为毛要搞这么久,本来是毫无悬念的,哎呀,还是要注意细节啊,虽然最后怎么过的还没搞明白。。。。。把判断的k<len换为k<len+1,oh,yeah
#include<iostream>#include<cstdio>#include<cmath>#include<cstring>#include<algorithm>#define maxn 1000050using namespace std;string s[maxn],map[maxn];int i=0,t=0,z=0;char ss[5000][5000];bool cmp(string a, string b){    return a<b;}char ch;void input(){    while(!getline(cin,s[i++]).eof());    //for(int j=0;j<i;j++)s[j]=ss[j];    /*for(int j=0;j<i;j++)    {        int len=s[j].length();        s[j][len]='.';    }*/    for(int j=0;j<i;j++)    {        int len=s[j].length();        for(int k=0;k<len;k++)        {            if(s[j][k]>='A'&&s[j][k]<='Z')s[j][k]=s[j][k]-'A'+'a';        }    }    for(int j=0;j<i;j++)    {        int len=s[j].length();        string ss="";        for(int k=0;k<len+1;k++)        {            if(s[j][k]>='a'&&s[j][k]<='z')ss+=s[j][k];            else            {                map[t++]=ss;                ss="";            }        }    }    sort(map,map+t,cmp);    //cout<<map[0]<<endl;    for(int j=1;j<t;j++)    {        if(map[j]!=map[j-1])cout<<map[j]<<endl;    }}int main(){    input();    return 0;}

原创粉丝点击