CF906E.Reverses

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Hurricane came to Berland and to suburbs Stringsvill. You are going to it to check if it's all right with you favorite string. Hurrinace broke it a bit by reversing some of its non-intersecting substrings. You have a photo of this string before hurricane and you want to restore it to original state using reversing minimum possible number of its substrings and find out which substrings you should reverse.

You are given a string ss — original state of your string and string tt — state of the string after hurricane. You should select kk non-intersecting substrings of tt in such a way that after reverse of these substrings string will be equal ss and kk is minimum possible.

输入格式

First line of input contains string ss and second line contains string tt . Both strings have same length and consist of lowercase English letters. 1<=s=t<=51051<=|s|=|t|<=5·10^{5}

输出格式

In first line print kk — minimum number of substrings you should reverse. Next output kk lines. Each line should contain two integers lil_{i} , rir_{i} meaning that you should reverse substring from symbol number lil_{i} to symbol rir_{i} (strings are 1-indexed). These substrings shouldn't intersect. If there are multiple answers print any. If it's impossible to restore string output -1.

输入输出样例

  • 输入#1

    abcxxxdef
    cbaxxxfed
    

    输出#1

    2
    7 9
    1 3
    
首页