408262: GYM103074 C Synonymous Words Number System
Description
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.
InputDifferent words with a length of N characters are written in two lines, one per line.
OutputIf 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.
ExamplesInput110001111Output
111100011
YESInput
1
3 7
110Output
010
NO