Computer Science, asked by ashoktiwari2737, 9 months ago

व्हाट इज द मैक्सिमम नंबर ऑफ कैरेक्टर दैट कैन वी यूज टू डिफाइंड द फील्ड नेम​

Answers

Answered by nikhil8687
2

Explanation:

Maximum number of characters between any two same character in a string

Given a string, find the maximum number of characters between any two same character in the string. If no character repeats, print -1.

Examples:

Input : str = "abba"

Output : 2

The maximum number of characters are

between two occurrences of 'a'.

Input : str = "baaabcddc"

Output : 3

The maximum number of characters are

between two occurrences of 'b'.

Input : str = "abc"

Output : -1

Similar questions