scanf格式控制

#include<bits/stdc++.h>
using namespace std;
bool solve(string A, string B) 
{
        // write code here

        int lenA=A.size();
        int lenB=B.size();
        if( lenA!=lenB )
        {
            return false;
        }

        A+=A;

        //查找子串
        if( -1== A.find(B,0) )
        {
            return false;
        }
        else
        {
            return true;
        }



    }


static const int maxn=1e5+5;
char a[maxn];
char b[maxn];

int main()
{
    //格式控制
    scanf("%[^;];%s",a,b);
    //printf("%s\n",a);
    //printf("%s\n",b);
    string A(a);
    string B(b);
    if( solve(A,B) )
    {
        cout<<"true"<<endl;
    }
    else
    {
        cout<<"false"<<endl;
    }

=
    return 0;
}

cin解决这个格式