TIU Assignment-7
TIU Assignment-7
1) Write a Python function that takes a string sentence as input and returns a
dictionary where keys are unique words in the sentence and values are the
frequencies of those words. Ignore case sensitivity and punctuation.
Input:
Str = “Hello world! Hello universe”
Output:
{'hello': 2, 'world': 1, 'universe': 1}
2) Write a python function that takes a list of strings words and groups them into lists
of anagrams. Anagrams are words that contain the same letters but in a different
order.
Input:
Output:
[['eat', 'tea', 'ate'], ['tan', 'nat'], ['bat']]
3) Write a python function that takes a string S and returns the length of the longest
substring without repeating characters.
Input 1:
S = "abcabcbb"
Output 1:
3 ("abc" or "bca")
Input 2:
S = " pwwkew"
Output 2:
3 ("wke")
TIU Internal