Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## Re:帮忙看看哪里出错了

Posted by l21c at 2006-02-22 00:20:42 on Problem 2629
In Reply To:帮忙看看哪里出错了 Posted by:l21c at 2006-02-22 00:20:23
```#include <string>
#include <iostream>
#include <vector>
using namespace std;

void print(char ch, int times)
{
for (int i=0; i<times; i++)
//	if (ch>='a' && ch<='z')
cout << ch;
}

void doit(string str1, string str2)
{
//cout << str1 << str2 << endl;
vector< int > data1, data2;
data1.assign(256, 0);
data2.assign(256, 0);

for (int i=0; i<str1.size(); i++)
{
++data1[str1[i]];
}
for (i=0; i<str2.size(); i++)
++data2[str2[i]];

for (i=0; i<data1.size(); i++)
{
int small = data1[i]<data2[i]?data1[i]:data2[i];
if (small>0)
print(i, small);
}
cout << endl;
}

int main()
{

char *str1, *str2;
str1 = new char[200], str2 = new char[200];
while (gets(str1) && gets(str2))
//	cin >> str1 >> str2;
doit(str1, str2);
return 0;
}```

Followed by: