#include <bits/stdc++.h>
using namespace std;
int search1(string str) {
for (int i = 0; i < str.size(); i++) {
if (str[i] == 'f') return i;
}
return -1;
}
int search2(string str) {
for (int i = str.size() - 1; i >= 0; i--) {
if (str[i] == 'f') return i;
}
return -1;
}
int main() {
string str = {};
getline(cin, str);
int a = search1(str);
int b = search2(str);
if (a != -1) {
if (a == b)
cout << a;
else
cout << a << " " << b;
}
return 0;
}
87
68
Объяснение:
127 = (1*8^2)+(2*8^1)+(7*8^0) = 64+16+7 = 87
75 = (7*9^1)+(5*9^0)= 63+5 = 68