#include using namespace std; #define int long long signed main(){ int ans = 10000; string S; cin>>S; int N = S.size(); for(int i=0;i