Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Will He Take the Workshop of 45 Batch?

By DarkknightRHZ · Limits 1s, 512 MB

45 batch students have recently completed their C Programming course. They are very much interested to start Competitive Programming. They went to their teacher Mr. Tahmid Rahman for workshop. But Mr. Tahmid Rahman is already very busy with scolding 36-44 batch. And he doesn’t have any time remaining to take workshop for them. But being a past acm programmer, he never ignores nor rejects the request of programmers. So he has given them a task to complete. If they can solve the problem before other batches, he will manage time to take extra workshops for them.

For this problem, you will just take two strings as Input. You need to find out in which positions do the characters in first string match with the characters in second string and should also find in which positions do the characters in second string match with the characters in first string.

If a character in one string is matched in more than one positions in second string, then print the position which is smaller. If there is no match then print -1 for that specific character. The comparison should be Case Insensitive. There should be a full stop (.) at the end of the output.

Input

Input will contain two strings in two separate lines. Number of characters in each string will be <= 1000. There will be no empty strings in input.

Output

Print two separate lines of output according to the problem description.

Samples

InputOutput
Jami 
Raihan
-1,1,-1,2.
-1,1,3,-1,1,-1.
InputOutput
Anika
Ashraful
0,-1,-1,-1,0.
0,-1,-1,-1,0,-1,-1,-1.
InputOutput
Maruf
Dipta
-1,4,-1,-1,-1.
-1,-1,-1,-1,1.

    Discussion

    Statistics


    91% Solution Ratio

    IamHotEarliest, Feb '18

    FrdhsnFastest, 0.0s

    dip_BRURLightest, 131 kB

    monir769Shortest, 418B

    Submit

    Login to submit

    Editorial

    -String -Brute Force / Implementation