0分C++蒟蒻求助!题面数据没错!
查看原帖
0分C++蒟蒻求助!题面数据没错!
947202
wangruize88楼主2023/7/24 11:23
#include <iostream>
#include <string>
using namespace std ;
string str[200] ;
string str1 , str2 ;
int main () {
	int i = 0 ;
	while ( cin >> str[i] ) {
		i ++ ;
		if ( cin.get() == '\n' ) break ;
	}
	cin >> str1 >> str2 ;
	for ( int j = 0 ; j < i ; j ++ ) {
		if ( str[j] == str1 ) str[j] = str2 ;
	}
	for ( int j = 0 ; j < i ; j ++ ) {
		cout << str[j] <<' ' ;
	}
	return 0 ;
}
2023/7/24 11:23
加载中...