Variable Description of Four Java Programs
1. Longest Consecutive Repetition
Variable Description
word Input word
maxChar Character with maximum consecutive
repetition
maxFreq Maximum consecutive frequency
currentChar Character currently being checked
currentFreq Frequency of current consecutive sequence
i Loop counter
2. Twin Words
Variable Description
w1 First word
w2 Second word
freq1[] Frequency array for first word
freq2[] Frequency array for second word
twin Stores whether words are twin words or
not
i Loop counter
3. Alternate Character Case
Variable Description
str Input sentence
result Converted sentence
pos Position count excluding spaces
ch Current character
i Loop counter
4. Longest Word and Position
Variable Description
s Input sentence
len Length of sentence
word Current word being formed
longWord Longest word found
maxLen Length of longest word
wordNo Current word number
pos Position of longest word
ch Current character
i Loop counter