You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
618 B
C++
25 lines
618 B
C++
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
string s1, s2;
|
|
getline(cin, s1);
|
|
getline(cin, s2);
|
|
s1 = " " + s1 + " ";
|
|
s2 = " " + s2 + " ";
|
|
for (auto &x : s1)
|
|
x = tolower(x);
|
|
for (auto &x : s2)
|
|
x = tolower(x);
|
|
int cnt = 0, fpos = 0;
|
|
for (auto lpos = s2.find(s1); lpos != string::npos; lpos = s2.find(s1, lpos + 1))
|
|
if (cnt++ == 0) fpos = lpos;
|
|
if (cnt)
|
|
cout << cnt << " " << fpos;
|
|
else
|
|
cout << -1;
|
|
return 0;
|
|
}
|