topcoder SRM 593 DIV2 WolfDelaymaster

时间:2023-03-08 19:40:08
 #include <iostream>
#include <string>
#include <algorithm> using namespace std; class WolfDelaymaster{
public:
bool checkChar(string str, char c, int start ,int num){
for(int i = start; i < start + num; ++ i ){
if(str[i] != c) return false;
}
return true;
} string check(string str){
for(int i = ; i < str.length();){
int j = i;
while(str[j] == 'w' && ++ j);
int num = j - i;
if(num == ) return "INVALID";
if(checkChar(str,'',j,num) && checkChar(str,'l',j+num,num) && checkChar(str,'f',j+*num,num))
{
i = j + *num;
}
else return "INVALID";
}
return "VALID";
} };