Im not going to implement the solution for you but I’ll give you the pusedocode.
for each letter1 in String1
for each letter2 in String2
if letter1 is letter2 then print its position
So you know you will need a nested for loop and a comparison, it becomes a bit more complicated if you want unique duplicates but i’ll leave the rest up to you
solved How to check if a string contains the characters from another string in Java? [duplicate]