求大佬找找我bug

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a,b;
    while(cin >> a >> b)
    {
        int s1 = a.length();
        int s2 = b.length();
        int i,j,k,p;
        int flag = 0;
        int q = 0;
        for(i = 0; i < s1; i++)
        {
            if(a[i] == b[0])
            {
                for(j = 0,p = i; j < s2,p < s1; p++,j++)
                {
                    if(a[p]!=b[j])
                    {
                        break;
                    }
                }
                if(p == s1)
                {
                    flag = 1;
                    for(k = i; k < s1; k++)
                    {
                        cout << a[k];
                    }
                    q = 1;
                    cout << endl;
                    break;
                }
            }    
        
        if(q == 0)
        {
            cout << "NULL!\n";
        }
    
    }
    return 0; 
}
全部评论

相关推荐

我冲冲冲冲冲:泪目了,好想选自己想选的答案啊
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务