408262: GYM103074 C Synonymous Words Number System

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. Synonymous Words Number System time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Synonymous Words Number System (SWNS) uses the lines of N characters consisting of '0' and '1' (2 ≤ N ≤ 10000). There is only one operation with words within the number system – it's called synonymization. Synonymization is reversing the character order in any substring containing even number of '1' symbols.

If we can create one word from the another one, by carrying out not more than 16·N synonymization, then such words are called synonyms.

It is necessary to determine whether the given words are synonymous, and, if so, find out the right sequence of synonymizations.

Input

Different words with a length of N characters are written in two lines, one per line.

Output

If the given words are not synonymous, output 'NO' in a single line.

Otherwise, output 'YES' in the first line. The second line contains an integer K (K ≤ 16·N) – a number of synonymization required for the conversion. The following K lines contain pairs of numbers that describe conversion of the first word into the second one. The first integer specifies a number of the first character participating in synonymization, and the second integer (always greater than the first one) – a number of the last character.

ExamplesInput
110001111
111100011
Output
YES
1
3 7
Input
110
010
Output
NO

加入题单

上一题 下一题 算法标签: