- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- string str1;
- string str2;
- int n;
- getline(cin,str1);
- getline(cin,str2);
- cin>>n;
- if(n>str1.length())
- {
- cout<<"error";
- }
- int sum=0;
- for(int i=0;i<n;i++)
- {
- sum=sum+(str1[i]-str2[i]);
- }
- if(sum>0)
- {
- cout<<str1<<" > "<<str2;
- }
- else if(sum<0)
- {
- cout<<str1<<" < "<<str2;
- }
- else
- {
- cout<<str1<<" = "<<str2;
- }
- return 0;
- }
複製代碼 |