1 solutions
-
0
C++ :
#include<bits/stdc++.h> using namespace std; string s1,s2; int ans,t,v[100];//因为重复的字符只输出一次,用 V数组标记是否已找到。 char ss[10000000]; int main() { // freopen("1016.in","r",stdin); // freopen("1016.out","w",stdout); cin>>s1>>s2; int len1=s1.size(),len2=s2.size(); for(int i=0;i<len1;i++) for(int j=0;j<len2;j++) { if(s1[i]==s2[j] && v[(int)s2[j]]==0) {ss[t++]=s1[i];v[(int)s2[j]]=1;} } sort(ss,ss+t); if(t==0) cout<<"WuXiao"; else if(t==1) cout<<"ZhiHui"<<endl<<ss[0]; else { cout<<"XLuo"<<endl<<t<<endl; for(int i=0;i<t-1;i++) cout<<ss[i]<<"-"; cout<<ss[t-1]; } return 0; }
- 1
Information
- ID
- 1066
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By