Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 5761 |

@blackshadows | 5701 |

@akhayrutdinov | 5111 |

@mb1973 | 4989 |

@Quandray | 4944 |

@saiujwal13083 | 4506 |

@sanjay05 | 3762 |

@marius_valentin_dragoi | 3516 |

@sushant_a | 3459 |

@verma_ji | 3341 |

@KshamaGupta | 3318 |

Complete Leaderboard | |

Handle | Score |

@aroranayan999 | 938 |

@bt8816103042 | 739 |

@SHOAIBVIJAPURE | 428 |

@codeantik | 412 |

@SherlockHolmes3 | 407 |

@neverevergiveup | 348 |

@mahlawatep | 347 |

@shalinibhataniya1097 | 343 |

@murarry3625 | 333 |

@saiujwal13083 | 326 |

@rohitanand | 314 |

Complete Leaderboard |

You are given two strings S1 and S2. You need to find weights of both strings and compare them. The weight of a string can be obtained by adding individual weights of the characters that make the string. The weight of individual characters are the position on which they occur in the english alphabets table; for eg, a has weight 1, z has weight 26.

**Input:**

The first line of the input contains a single integer T, denoting the number of test cases. Then T test cases follow. Each testcase has 2 lines

The first string S1

The second string S2

**Output:**

Print 1 if the weight of the first string is greater. Print 2 if the weight of the second string is greater. Print equal if the the weights are equal.

**Constraints:**

1<=T<=100

1<=|S1|<=1000

1<=|S2|<=1000

**Example:**

**Input:**

4

batman

superman

kira

l

goku

broly

manbat

batman

**Output:**

2

1

2

equal

**Note: **The strings contains only lowercase characters.

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
Weight of strings

...