#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define inf 1e18
const int mod=1e9+7;
const int N=2e5+5;
bool check(char a,char b){
return ((a-'0')*10+(b-'0'))%4==0;
}
void solve(){
string s;
cin>>s;
if(s.size()==1){
if((s[0]-'0')%4==0) cout<<0;
else cout<<-1;
return;
}
if(check(s[s.size()-2],s[s.size()-1])){
cout<<0;
return;
}
if(check(s[s.size()-1],s[0])){
cout<<1;
return;
}
int ans=1;
for(int i=0;i<s.size()-3;i++){
if(check(s[i],s[i+1])){
cout<<i+2;
return;
}
}
cout<<-1;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int tt=1;
// cin>>tt;
while(tt--) solve();
return 0;
}
小红的循环移位(模拟&枚举)--牛客周赛 Round 41-C
最新推荐文章于 2024-07-25 11:18:29 发布