class Solution {
public:
int findMinimumOperations(string s1, string s2, string s3) {
int n = min({s1.size(), s2.size(), s3.size()});
int i = 0;
while (i < n && s1[i] == s2[i] && s1[i] == s3[i]) i ++ ;
if (!i) return -1;
return max((int)(s1.size() + s2.size() + s3.size() - i * 3), 0);
}
};