View Code of Problem 84

#include <iostream>
#include <string.h>
using namespace std;

int main(){
  char str[1000];
  int len;
  bool flag;
  while(gets(str)!=NULL){
    len = strlen(str);
    flag = false;
    for(int j=0;j<len;j++){
      if((str[j]=='S'||str[j]=='s')&&(str[j+1]=='A'||str[j+1]=='a')&&(str[j+2]=='L'||str[j+2]=='l')&&(str[j+3]=='T'||str[j+3]=='t')){
      	flag = true;
      	break;
      }
    }
    if (flag)
    	printf("%s\n", str);
  }
  return 0;
}

Double click to view unformatted code.


Back to problem 84