View Code of Problem 121

#include<stdio.h>
#include <string.h>
#include <math.h>
void main()
{
	int i,j;
	char s[1000],a[1000];
	while(gets(s)!=EOF)
	{
		for(i=0;i<strlen(s);i++)
		{
			if(s[i]>='a'&&s[i]<='z'||s[i]>='A'&&s[i]<='Z')  //occupation
			{
				if(i+10<=strlen(s)-1)
				{
if(s[i]=='o'&&s[i+1]=='c'&&s[i+2]=='c'&&s[i+3]=='u'&&s[i+4]=='p'&&s[i+5]=='a'&&s[i+6]=='t'&&s[i+7]=='i'&&s[i+8]=='o'&&s[i+9]=='n')
{
	printf("OH-OH-OH-QQ-PEI-PEI-SHION");
	i=i+9;
}
else
  printf("%c",s[i]);
				}
				else
					printf("%c",s[i]);
			}
			else
			printf("%c",s[i]);
		
		}
		printf("\n");
		
	}
    
}

Double click to view unformatted code.


Back to problem 121