Problems
IP-address
Есть тесты, где находится две точки подряд.
^ чоткий чувак
include <bits/stdc++.h>
using namespace std; using ll = long long;
int main() { iosbase::syncwith_stdio(0); cin.tie(0);
string s;
cin >> s;
int eded = 0;
if(s[0] == '.' || s[s.size()-1] == '.') {cout << 0; return 0;}
s += '.';
for(int i=0; i<s.size(); i++){
if(s[i] == '.' && s[i+1] == '.') {cout << 0; return 0;}
if(s[i] != '.'){
eded *= 10;
eded += s[i]-'0';
} else {
if(eded > 255 || eded < 0){
cout << 0;
return 0;
}
eded = 0;
}
}
cout << 1;
}
//authour Nicat Huseynli
include <iostream>
using namespace std; int main() { int a , b , c , d; char a1 , b1 , c1; cin>>a>>a1>>b>>b1>>c>>c1>>d; if(a < 256 and b < 256 and c < 256 and d < 256 and a1 == '.' and b1 == '.' and c1 == '.'){ cout<<1; } else{ cout<<0; } }