CF39J.Spelling Check
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, that’s why he decided to invent the function that will correct the words itself. Petya started from analyzing the case that happens to him most of the time, when all one needs is to delete one letter for the word to match a word from the dictionary. Thus, Petya faces one mini-task: he has a printed word and a word from the dictionary, and he should delete one letter from the first word to get the second one. And now the very non-trivial question that Petya faces is: which letter should he delete?
佩佳注意到,自己在键盘上打字时,经常会多按一些按键,从而在单词中多输入一些字母。当然,拼写检查系统会为他标出这些单词,他不得不逐个点击每个单词并选择正确的拼写。佩佳厌倦了手动纠正自己的错误,因此决定编写一个能自动修正单词的函数。他首先分析了自己最常遇到的情况:只需从单词中删除一个字母,该单词就能与词典中的某个单词匹配。于是,佩佳面临一个小型任务:他有一个已输入的单词和一个词典中的单词,他需要从第一个单词中删去一个字母,使其变成第二个单词。现在,佩佳面临一个非常不平凡的问题:他应该删去哪一个字母?
输入格式
The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one.
输入数据包含两个字符串,均由小写拉丁字母组成。每个字符串的长度为 1 到 106 个字符(含端点),且第一个字符串比第二个字符串恰好多 1 个字符。
输出格式
In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible to make the first string identical to the second string by deleting one symbol, output one number 0.
第一行输出第一个字符串中符号的位置个数,使得删除这些位置上的符号后,第一个字符串与第二个字符串完全相同。
第二行按升序输出这些位置(以空格分隔)。位置编号从 1 开始。
如果无法通过删除一个符号使第一个字符串与第二个字符串相同,则输出一个数字 0。
输入输出样例
输入#1
abdrakadabra abrakadabra
输出#1
1 3
输入#2
aa a
输出#2
2 1 2
输入#3
competition codeforces
输出#3
0
输入解题思路,AI测评打分。不知道怎么写?