Dictionary Usage 2 - Java
Submissions: 216   Accuracy:


  Difficulty: Easy   Marks: 2
Associated Course(s):   Fork Java

Given a dictionary of n words. You have to display the size of dictionary before and after.

Input Format:
The first line of input contains T denoting thr number of testcases. T testcases follow. Each testcase contains 4 lines of input. The first line contains the number of words n. The second line contains the n  page numbers separated by space. The third line contains n words separated by space. The ith index of word array corresponds to ith index of page numbers array. . The 4th line contains pagenumber x.

Output Format:
For each testcase, in a new line, print the required answer.

Your Task:
Since this is a function problem, you don't need to take any input. Your task is to complete the two functions -  Dictionary() which accepts dictionary, and sizeAfterRemoval() which accepts dictionary and the page number. You have to display the word at that page and evaluate the size after removing the word at the specified page.

1 <= T <= 100
1 <= n <= 1000

123 456 500 550 600
study reference learn code practice

Size before removing word: 5
Word removed from dictionary: practice
Size after removing word: 4

Initially we have 5 words, so size is 5.  Then we remove the words that is mapped to page number 600. Now size becomes 4.


** For More Input/Output Examples Use 'Expected Output' option **

Author: Soul_xhacker

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.