ex1

 avatar
unknown
plain_text
2 years ago
415 B
5
Indexable
#include <stdio.h>
#include <string.h>

int main(){
	char word[500],prevChar;
	scanf("%s", word);
	int wordLength = strlen(word),i;
	prevChar=word[0];
	for(i=1;i<wordLength;i++){
		prevChar=word[i-1];
		if(word[i]=='A' && prevChar=='C'){
			printf("Inconclusive result");
			return 0;
		}
		else if (word[i]=='A'){
			printf("Asterioid Detected!");
			return 0;
		}
	}
	printf("No Asteroids Detected");
	return 0;
}
Editor is loading...