Erelong Leha was bored by calculating of the greatest common divisor of two factorials. Therefore he decided to solve some crosswords. It's well known that it is a very interesting occupation though it can be very difficult from time to time. In the course of solving one of the crosswords, Leha had to solve a simple task. You are able to do it too, aren't you?

Leha has two strings s and t. The hacker wants to change the string s at such way, that it can be found in t as a substring. All the changes should be the following: Leha chooses one position in the string s and replaces the symbol in this position with the question mark "?". The hacker is sure that the question mark in comparison can play the role of an arbitrary symbol. For example, if he gets string s="ab?b" as a result, it will appear in t="aabrbb" as a substring.

Guaranteed that the length of the string s doesn't exceed the length of the string t. Help the hacker to replace in s as few symbols as possible so that the result of the replacements can be found in t as a substring. The symbol "?" should be considered equal to any other symbol.

Input

The first line contains two integers n and m (1 ≤ n ≤ m ≤ 1000) — the length of the string s and the length of the string t correspondingly.

The second line contains n lowercase English letters — string s.

The third line contains m lowercase English letters — string t.

Output

In the first line print single integer k — the minimal number of symbols that need to be replaced.

In the second line print k distinct integers denoting the positions of symbols in the string s which need to be replaced. Print the positions in any order. If there are several solutions print any of them. The numbering of the positions begins from one.

Examples

Input
3 5
abc
xaybz
Output
2
2 3
Input
4 10
abcd
ebceabazcd
Output
1
2
 #include<bits/stdc++.h>
using namespace std; int main() {
int a,b,count;
int ans = ;
int yy[],re[];
char str1[],str2[];
cin>>a>>b;
cin>>str1;
cin>>str2;
queue<int>que;
ans = ;
for(int i = ; i <= b - a; i++) {
count = ;
for(int j = ; j < a; j++) {
if(str1[j] != str2[j+i]) {
yy[count] = j;
count++;
}
}
if(count < ans) {
for(int k = ; k < count; k++) {
re[k] = yy[k];
}
ans = count;
}
}
cout<<ans<<endl;
for(int i = ; i < ans; i++) {
cout<<re[i]+<<" ";
}
cout<<endl;
return ;
}

B - Crossword solving的更多相关文章

  1. Codeforces822 B. Crossword solving

    B. Crossword solving time limit per test 1 second memory limit per test 256 megabytes input standard ...

  2. Codeforces Round #422 (Div. 2) B. Crossword solving 枚举

    B. Crossword solving     Erelong Leha was bored by calculating of the greatest common divisor of two ...

  3. cf 822B Crossword solving

    B. Crossword solving time limit per test 1 second memory limit per test 256 megabytes input standard ...

  4. 【Codeforces Round #422 (Div. 2) B】Crossword solving

    [题目链接]:http://codeforces.com/contest/822/problem/B [题意] 让你用s去匹配t,问你最少需要修改s中的多少个字符; 才能在t中匹配到s; [题解] O ...

  5. Codeforces Round #422 (Div. 2)

    Codeforces Round #422 (Div. 2) Table of Contents Codeforces Round #422 (Div. 2)Problem A. I'm bored ...

  6. CF-822B

    B. Crossword solving time limit per test 1 second memory limit per test 256 megabytes input standard ...

  7. codeforces round 422 div2 补题 CF 822 A-F

    A I'm bored with life 水题 #include<bits/stdc++.h> using namespace std; typedef long long int LL ...

  8. ACM团队周赛题解(3)

    940和822两套div.2 老规矩 #define MAXN 1000000+5#define MOD 1000000007#define PI (acos(-1.0))#define EPS 1e ...

  9. 【BZOJ1700】[Usaco2007 Jan]Problem Solving 解题 动态规划

    [BZOJ1700][Usaco2007 Jan]Problem Solving 解题 Description 过去的日子里,农夫John的牛没有任何题目. 可是现在他们有题目,有很多的题目. 精确地 ...

随机推荐

  1. 多平台密码绕过及提权工具Kon-Boot的使用与防范

    在单用户的机器上密码可能没那么重要,但是一旦有多个用户可以使用这台机器,密码就显得十分必要了(比如有儿童账户的电脑).所以说为你的电脑增设一条防线的最常用,最简单的方法就是用密码将你的电脑保护起来,但 ...

  2. Feign简介

    Feign简介

  3. MySQL5.6 怎样优化慢查询的SQL语句 -- 慢日志介绍

    近期有个开发团队抱怨我们平台包括的mysql cluster不行,总是报mysql的"heartbeat Error".分析了他们收集的日志.没有发现mysql cluster节点 ...

  4. react 从零开始搭建开发环境

    1.创建 package.json 项目 npm init 2.安装 webpack, 并且设置为项目依赖: npm install webpack --save-dev 当然你必须之前已经在 -g ...

  5. poj2488--A Knight&#39;s Journey(dfs,骑士问题)

    A Knight's Journey Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 31147   Accepted: 10 ...

  6. Random产生随机数问题

    昨天在开发时发现这个问题,在同一个for循环内,通过Random多次产生随机数得到的随机数竟是一样的!以前还真没发现这个问题. 以下是简化的代码,如果将random定义在for循环外面则不会有问题(猜 ...

  7. Python爬虫开发【第1篇】【多线程爬虫及案例】

    糗事百科爬虫实例: 地址:http://www.qiushibaike.com/8hr/page/1 需求: 使用requests获取页面信息,用XPath / re 做数据提取 获取每个帖子里的用户 ...

  8. Servlet的引入

    一.分析 此模式有问题: 1.jsp需要呼叫javabean StudentService stuService = new StudentServiceImpl(); List<Student ...

  9. VMnet1和VMnet8 未识别的网络的解决方法

    我的系统是win7 64位,它居然不能识别VMnet1和VMnet8,在网上找了些资料,发现所有资料都是一样的.不过事实证明是正确的. 解决办法: 1,在运行中输入regedit 2,进入注册表[HK ...

  10. ubuntu 文件及子文件夹的权限的查看及修改

    查看linux文件的权限:  查看path路径下名为filename的文件或文件夹的权限:   * -R   结果:全部子目录及文件权限改为 777