ACdream ACfun

题目不难,但因为个人英语不好。

。。。

百度了下。题目意思是要求出字典序最小的而且不是所输入字符的子串;

也就是输出最多的连续的A;

假设没有A,输出一个A;

#include<stdio.h>
#include<string.h>
int main()
{
	int a,i,j,b,c,d;
	char t[105];
	scanf("%d",&a);
	while(a--)
	{
		d=1;
		scanf("%s",t);
		b=strlen(t);
		for(i=0;i<b;)
		{
			c=1;
			if(t[i]=='A')
			{
				for(j=i;j<b;j++)
				{
					if(t[j]=='A')
						c++;
					else
						break;
				}
				i=j;
			}
			else
				i++;
			if(c>d)
				d=c;
		}
		for(j=0;j<d;j++)
			printf("A");
		printf("
");
	}
	return 0;
}


原文地址:https://www.cnblogs.com/wgwyanfs/p/6814518.html