P1597洛谷刷题

#include <iostream>
#include <string>
using namespace std;
int main(int argc, char** argv) {
	string str = "a:=3;b:=4;c:=5";
	for(int i = 1;i<=3;i++){
		int startIndex = str.find(";");
		string a = str.substr(0,startIndex);
		a = a.substr(a.find("=")+1,a.size());
		str = str.replace(0,startIndex+1,"");
		cout<<a<<" ";
	}
	return 0;
}

  

posted @ 2022-10-29 20:18  王一行  阅读(13)  评论(0)    收藏  举报