Codeforces 197C 觅最大子串(字典序
发布时间: 2013-01-06 15:44:47 作者: rapoo
Codeforces 197C 找最大子串(字典序 可以不连续)
http://codeforces.com/problemset/problem/197/C
By hnust_xiehonghao, contest: Codeforces Round #124 (Div. 2), problem: (C) Lexicographically Maximum Subsequence, Accepted, ##include<stdio.h>#include<string.h>char s[1000000];char ans[1000000];int main(){int i,len,cnt;char max=0; while(scanf("%s",s)!=EOF){max=0;cnt=1000000-1;len=strlen(s);for(i=len-1;i>=0;i--){if(s[i]>=max) {max=s[i]; ans[cnt--]=s[i];}}//puts(ans);//ans[cnt]=0;for(i=cnt+1;i<1000000;i++)printf("%c",ans[i]);printf("\n"); }return 0;}