题目链接:https://vjudge.net/problem/UVA-1584
题解:用strcpy与strcmp定长比较字符串即可,strcat与strcmp对string不适用,所以只能改写为char字符串
ac代码:
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int main()
{
int n;
char a[1100],b[1100],t[1100];
cin>>n;
while(n--)
{
cin>>a;
int k=strlen(a);
strcpy(t,a);
strcat(a,t);
for(int i=0;i<k;i++)
if(strncmp(t,a+i,k)>0)
strncpy(t,a+i,k);
cout<<t<<endl;
}
return 0;
}