機械の総合病院 [MISSION LEVEL: C]
1 #include <bits/stdc++.h> 2 #define _for(i,a,b) for(int i = (a);i < (b);i ++) 3 #define pb push_back 4 using namespace std; 5 6 int main() 7 { 8 string s; 9 cin >> s; 10 if(s.size()<6){ 11 cout << "Invalid";return 0; 12 } 13 int f1 = 0,f2 = 0; 14 _for(i,0,s.size()) 15 { 16 if(isdigit(s[i])) 17 f1 = 1; 18 else if(isalpha(s[i])) 19 f2 = 1; 20 } 21 if((!f1)||(!f2)){ 22 cout << "Invalid";return 0; 23 } 24 _for(i,0,s.size()-2) 25 if(tolower(s[i])==tolower(s[i+1])&& tolower(s[i])==tolower(s[i+2])) 26 { 27 cout << "Invalid";return 0; 28 } 29 cout << "Valid"; 30 return 0; 31 }