Codeforces Round #422 (Div. 2), problem: (B) Crossword solving Solution In C/C++

#include<bits/stdc++.h>
using namespace std;
int n,m,i,j,c,a=2e9,ai;

string s,t;
int main(){
cin>>n>>m>>s>>t;
for(i=0;i<=m-n;i++)
{
for(c=j=0;j<n;j++)
t[i+j]==s[j]?0:c++;
c<a?a=c,ai=i:0;
}
cout<<a<<endl;
for(c=j=0;j<n;j++)
t[ai+j]!=s[j]?cout<<j+1<<” “,0:0;
}

(Visited 74 times, 1 visits today)

About the Author:

Leave A Comment