ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

Open Ural FU Championship 2012

About     Problems     Submit solution     Judge status     Standings
Contest is over

G. Davy Jones’s Organ

Time limit: 1.0 second
Memory limit: 64 MB
Gibbs: Quiet, missy. Cursed pirates sail these waters. You don't wanna bring them down on us, do you?
James Norrington: Mr. Gibbs, that will do.
Gibbs: She was singing about pirates. Bad luck to be singing about pirates with us mired in this unnatural fog, mark my words.
Two melodies don’t go out of Davy Jones’s head. One of them or another sometimes emerge in his mind. To get rid of annoying melodies, Davy Jones decided to play them on his organ. At first, he wants consiquently perform first and second melodies. And then Davy Jones is going to play the same notes as the first time but in the reverse order.
If the first and second compositions sound exactly the same, then, according to Davy Jones's idea, the melodies will no longer vary by his subconscious and finally will leave him alone.
Jones recorded the notes of both songs. He was sure in the song’s duration, but not really in which place every song begins. But it is not important, because they play cyclically in his mind and you can choose any place as a start in each of them.


In the first line of the input you are given a string of length n — sequence of notes of the first melody. In the second line there is a string of length m — sequence of notes of the second melody (1 ≤ m < n ≤ 105). Each note is represented by lowercase Latin letter. Order of notes in the melody corresponds to their order in its playback accurate within start of the melody.


If it is impossible to play compositions conceived by Davy Jones's way, output “No”. Otherwise, in the first line write “Yes” and in the second — a pair of integers — numbers of notes in the first and second tunes respectively, which you should choose as a start. Numbering of notes corresponds to a record of melodiess in the input and starts from one. If there are several possible solutions, output any.


5 3
Problem Author: Olga Soboleva (prepared by Egor Shchelkonogov)
Problem Source: Open Ural FU Championship 2012
To submit the solution for this problem go to the Problem set: 1937. Davy Jones’s Organ