Last Updated: 30 Sep, 2025

String Mismatch Finder

Easy
Asked in company
EPAM Systems

Problem statement

You are given two strings, s1 and s2, which are guaranteed to be of the same length.


Your task is to compare these two strings character by character and identify all the positions (indices) where they differ. You need to return a list of these 0-indexed positions.


Input Format:
The first line of input contains the string s1.

The second line of input contains the string s2.


Output Format:
Print a single line containing the 0-indexed positions where the characters differ, sorted in ascending order and separated by single spaces.

If the two strings are identical (no mismatches), print a single line with the value -1.


Note:
The comparison is case-sensitive. 'a' and 'A' are considered different.

The strings are guaranteed to have the same length.