View Code of Problem 3496

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

//除法一定要用double
 
int main()
{
	char str[1000]; 
	while(gets(str))
	{	
		string word = "";
		int len = strlen(str);
		for(int i = 0; i < len; i++)
		{
			if(str[i] != ' ')
			{
				word += str[i] ;		
			}	
			else
			{
				if(word == "you")
				{
					cout << "we" ;
				}
				else
				{
					cout << word;					
				}
				cout << str[i];
				word = "";
		
			}
		}
		if(word == "you")
		{
			cout << "we" ;
		}
		else
		{
			cout << word;
		}
		cout << endl;	
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3496