fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3. int main(){
  4. int c=0;
  5. string n,a,b;
  6. while(cin >> a >> n >> b){
  7. if(n=="=="){
  8. if(a.length()==b.length()){
  9. for(int i=0;i<a.length();i++){
  10. if(a[i]!=b[i]){
  11. cout << 0 << endl;
  12. }
  13. else{
  14. c++;
  15. }
  16. if(c==a.length()){
  17. cout << 1 << endl;
  18. c=0;
  19. }
  20. }
  21. }
  22. else{
  23. cout << 0 << endl;
  24. }
  25. }
  26. else if(n=="<="){
  27. if(a.length()<b.length()){
  28. cout << 1 << endl;
  29. }
  30. else if(b.length()<a.length()){
  31. cout << 0 << endl;
  32. }
  33. else{
  34. for(int i=0;i<a.length();i++){
  35. if(a[i]>b[i]){
  36. c++;
  37. cout << 0 << endl;
  38. }
  39. }
  40. if(c==0){
  41. cout << 1 << endl;
  42. c=0;
  43. }
  44. }
  45. }
  46. else if(n==">="){
  47. if(a.length()<b.length()){
  48. cout << 0 << endl;
  49. }
  50. else if(b.length()<a.length()){
  51. cout << 1 << endl;
  52. }
  53. else{
  54. for(int i=0;i<a.length();i++){
  55. if(a[i]<b[i]){
  56. c++;
  57. cout << 0 << endl;
  58. }
  59. }
  60. if(c==0){
  61. cout << 1 << endl;
  62. c=0;
  63. }
  64. }
  65. }
  66. else if(n=="!="){
  67. if(a.length()==b.length()){
  68. for(int i=0;i<a.length();i++){
  69. if(a[i]!=b[i]){
  70. cout << 1 << endl;
  71. }
  72. else{
  73. c++;
  74. }
  75. if(c==a.length()){
  76. cout << 0 << endl;
  77. c=0;
  78. }
  79. }
  80. }
  81. else{
  82. cout << 1 << endl;
  83. }
  84. }
  85. c=0;
  86. }
  87. }
Success #stdin #stdout 0.01s 5268KB
stdin
100 == 200
200 <= 100
200 >= 100
stdout
0
0
1