为啥全屏re?
查看原帖
为啥全屏re?
561949
syr1125楼主2022/1/24 21:12
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
 
int main()
{
     char a[500];
     char b[500];
     int n = 0, i = 0;
     while ((a[n ++] = getchar()) != '\n');
     while ((b[i ++] = getchar()) != '\n');
     a[-- n] = '\0';
     b[-- i] = '\0';
     if (strstr(a, b))
	  { 
		cout << b << " is substring of " << a << endl;
	   }
	   else if (strstr(b, a))
	   { 
		cout << a << " is substring of " << b << endl;
	   }
	   if (!(strstr(b, a) || strstr(a, b)))
	   {
		cout << "No substring" << endl;
	   }
	   return 0;
}

排版可能很垃圾,大佬勿喷。

2022/1/24 21:12
加载中...