聊天服务器的外部流量

在这里插入图片描述
.
.
.
.
.
.
分析
一道nc题,注意空格也是信息
.
.
.
.
.
.
程序:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
int tj=0,ans=0;
int main()
{
	while (!cin.eof())
	{
		string zfc,w="";
		getline(cin,zfc);
		char ch=zfc[0];
		if (ch=='+') tj++; else
		if (ch=='-') tj--; else
		{
			int l=zfc.length(),bz=0;
			for (int i=0;i<=l-1;i++)
				if (zfc[i]==':') 
				{
					ans+=(l-(i+1))*tj;
					break;
				}
		}
	}
	printf("%d",ans);
	return 0;
}
原文地址:https://www.cnblogs.com/YYC-0304/p/10292836.html