View Code of Problem 3496

#include<stdio.h>
#include<string.h>
int main(void){
	char str[1000];
	char a[5]="you";
	char b[5]="we";
	while(gets(str)!=NULL){
		char *t;
		char temp[1000][1000];
		int index=0;
		t=strtok(str," ");
		do{
			if(strcmp(t,a)==0){
				strcpy(temp[index],b); 
			}
			else
				strcpy(temp[index],t);
			index++;
		}while(t=strtok(NULL," "));
		for(int i=0;i<index;i++){
			if(i!=index-1){
				printf("%s ",temp[i]);
			}
			else 
				printf("%s",temp[i]); 
		}
	}
	
}

Double click to view unformatted code.


Back to problem 3496