#include <stdio.h>
#include <stdbool.h>
#include <string.h>
int min(int a, int b){
return a < b ? a : b;
}
int distance(char str1[], char str2[], int index1, int index2){
if (index1 < 0) {
return index2 + 1;
}
if (index2 < 0) {
return index1 + 1;
}
if(str1[index1] == str2[index2]){
return distance(str1, str2, index1 - 1, index2 - 1);
}
else{
return min(distance(str1, str2, index1 - 1, index2), distance(str1, str2, index1, index2 - 1)) + 1;
}
}
int main()
{
char str[100][11];
int i=0;
while(scanf("%s", str
[i
]) != EOF
){ i++;
}
int min_distance = 1000000000;
int min_index1 = 0;
int min_index2 = 0;
for(int j = 0; j < i; j++){
for(int k = j + 1; k < i; k++){
if(distance
(str
[j
], str
[k
], strlen(str
[j
]) - 1, strlen(str
[k
]) - 1) < min_distance
){ int min = min_distance;
min_distance
= distance
(str
[j
], str
[k
], strlen(str
[j
]) - 1, strlen(str
[k
]) - 1); min_index1 = j;
min_index2 = k;
}
}
}
printf("%d %d %d", min_distance
, min_index1
+ 1, min_index2
+ 1); }
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRib29sLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KaW50IG1pbihpbnQgYSwgaW50IGIpewogICAgcmV0dXJuIGEgPCBiID8gYSA6IGI7Cn0KaW50IGRpc3RhbmNlKGNoYXIgc3RyMVtdLCBjaGFyIHN0cjJbXSwgaW50IGluZGV4MSwgaW50IGluZGV4Mil7CiAgICAKICAgIGlmIChpbmRleDEgPCAwKSB7CiAgICAgICAgcmV0dXJuIGluZGV4MiArIDE7CiAgICB9CiAgICBpZiAoaW5kZXgyIDwgMCkgewogICAgICAgIHJldHVybiBpbmRleDEgKyAxOwogICAgfQogCiAgICBpZihzdHIxW2luZGV4MV0gPT0gc3RyMltpbmRleDJdKXsKICAgICAgICByZXR1cm4gZGlzdGFuY2Uoc3RyMSwgc3RyMiwgaW5kZXgxIC0gMSwgaW5kZXgyIC0gMSk7CiAgICB9CiAgICBlbHNlewogICAgICAgIHJldHVybiBtaW4oZGlzdGFuY2Uoc3RyMSwgc3RyMiwgaW5kZXgxIC0gMSwgaW5kZXgyKSwgZGlzdGFuY2Uoc3RyMSwgc3RyMiwgaW5kZXgxLCBpbmRleDIgLSAxKSkgKyAxOwogICAgfQp9CmludCBtYWluKCkKewogICAgY2hhciBzdHJbMTAwXVsxMV07CiAgICBpbnQgaT0wOwogICAgd2hpbGUoc2NhbmYoIiVzIiwgc3RyW2ldKSAhPSBFT0YpewogICAgICAgIGkrKzsKICAgIH0KICAgIGludCBtaW5fZGlzdGFuY2UgPSAxMDAwMDAwMDAwOwogICAgaW50IG1pbl9pbmRleDEgPSAwOwogICAgaW50IG1pbl9pbmRleDIgPSAwOwogICAgZm9yKGludCBqID0gMDsgaiA8IGk7IGorKyl7CiAgICAgICAgZm9yKGludCBrID0gaiArIDE7IGsgPCBpOyBrKyspewogICAgICAgICAgICBpZihkaXN0YW5jZShzdHJbal0sIHN0cltrXSwgc3RybGVuKHN0cltqXSkgLSAxLCBzdHJsZW4oc3RyW2tdKSAtIDEpIDwgbWluX2Rpc3RhbmNlKXsKICAgICAgICAgICAgICAgIGludCBtaW4gPSBtaW5fZGlzdGFuY2U7CiAgICAgICAgICAgICAgICBtaW5fZGlzdGFuY2UgPSBkaXN0YW5jZShzdHJbal0sIHN0cltrXSwgc3RybGVuKHN0cltqXSkgLSAxLCBzdHJsZW4oc3RyW2tdKSAtIDEpOwogICAgICAgICAgICAgICAgbWluX2luZGV4MSA9IGo7CiAgICAgICAgICAgICAgICBtaW5faW5kZXgyID0gazsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIHByaW50ZigiJWQgJWQgJWQiLCBtaW5fZGlzdGFuY2UsIG1pbl9pbmRleDEgKyAxLCBtaW5faW5kZXgyICsgMSk7Cn0=