dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
class GFG { static void printString ( char [ ] str , int n ) { int ones = 0 ; for ( int i = 0 ; i < n ; i ++ ) if ( str [ i ] == '1' ) ones ++ ; boolean used = false ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] == '2' && ! used ) { used = true ; for ( int j = 0 ; j < ones ; j ++ ) System . out . print ( "1" ) ; } if ( str [ i ] != '1' ) System . out . print ( str [ i ] ) ; } if ( ! used ) for ( int j = 0 ; j < ones ; j ++ ) System . out . print ( "1" ) ; } public static void main ( String [ ] args ) { String str = "100210" ; int n = str . length ( ) ; printString ( str . toCharArray ( ) , n ) ; } }

Index/key variables: i
Accumulator variables: i, j, ones
Iterator variables: i, j
Boolean variables: used
Class/struct names: GFG
Java program:
import java . util . * ; class solution { static int findPermutation ( String str , int k ) { boolean [ ] has = new boolean [ 26 ] ; Arrays . fill ( has , false ) ; int cnt = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( ! has [ str . charAt ( i ) - ' a ' ] ) { cnt ++ ; has [ str . charAt ( i ) - ' a ' ] = true ; } } int ans = 1 ; for ( int i = 2 ; i <= cnt ; i ++ ) ans *= i ; for ( int i = cnt - k ; i > 1 ; i -- ) ans /= i ; return ans ; } public static void main ( String args [ ] ) { String str = " geeksforgeeks " ; int k = 4 ; System . out . println ( findPermutation ( str , k ) ) ; } }

Accumulator variables: ans, cnt, i
Iterator variables: i
Class/struct names: solution
Java program:
class GFG { static int product ( int x ) { int prod = 1 ; while ( x > 0 ) { prod *= ( x % 10 ) ; x /= 10 ; } return prod ; } static int findNumber ( int l , int r ) { String b = Integer . toString ( r ) ; int ans = r ; for ( int i = 0 ; i < b . length ( ) ; i ++ ) { if ( b . charAt ( i ) == '0' ) continue ; char [ ] curr = b . toCharArray ( ) ; curr [ i ] = ( char ) ( ( ( int ) ( curr [ i ] - ( int ) '0' ) - 1 ) + ( int ) ( '0' ) ) ; for ( int j = i + 1 ; j < curr . length ; j ++ ) curr [ j ] = '9' ; int num = 0 ; for ( int j = 0 ; j < curr . length ; j ++ ) num = num * 10 + ( curr [ j ] - '0' ) ; if ( num >= l && product ( ans ) < product ( num ) ) ans = num ; } return ans ; } public static void main ( String [ ] args ) { int l = 1 , r = 10 ; System . out . println ( findNumber ( l , r ) ) ; l = 51 ; r = 62 ; System . out . println ( findNumber ( l , r ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, prod, x
Iterator variables: i, j
Class/struct names: GFG
Java program:
public class GFG { static void printExpansion ( String str ) { for ( int i = str . length ( ) - 1 ; i >= 0 ; i -- ) { String subStr = str . substring ( i ) ; System . out . print ( subStr ) ; } } public static void main ( String args [ ] ) { String str = " geeks " ; printExpansion ( str ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void constructBinString ( int a , int b , int x ) { int d , i ; d = x / 2 ; if ( x % 2 == 0 && x / 2 != a ) { d -- ; System . out . print ( "0" ) ; a -- ; } for ( i = 0 ; i < d ; i ++ ) System . out . print ( "10" ) ; a = a - d ; b = b - d ; for ( i = 0 ; i < b ; i ++ ) { System . out . print ( "1" ) ; } for ( i = 0 ; i < a ; i ++ ) { System . out . print ( "0" ) ; } } public static void main ( String [ ] args ) { int a = 4 , b = 3 , x = 2 ; constructBinString ( a , b , x ) ; } }

Accumulator variables: a, d, i
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static boolean matchPattern ( String s ) { int count = 0 ; int n = s . length ( ) ; int i = 0 ; while ( i < n ) { while ( i < n && s . charAt ( i ) == ' a ' ) { count ++ ; i ++ ; } while ( i < n && s . charAt ( i ) == ' b ' ) { count -- ; i ++ ; } if ( count != 0 ) return false ; } return true ; } public static void main ( String [ ] args ) { String s = " bb " ; if ( matchPattern ( s ) == true ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: count, i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int maximum_one ( String s , int n ) { int cnt_one = 0 ; int max_cnt = 0 , temp = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == '1' ) { cnt_one ++ ; temp ++ ; } else { max_cnt = Math . max ( max_cnt , temp ) ; temp = 0 ; } } max_cnt = Math . max ( max_cnt , temp ) ; int [ ] left = new int [ n ] ; int right [ ] = new int [ n ] ; if ( s . charAt ( 0 ) == '1' ) left [ 0 ] = 1 ; else left [ 0 ] = 0 ; if ( s . charAt ( n - 1 ) == '1' ) right [ n - 1 ] = 1 ; else right [ n - 1 ] = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( s . charAt ( i ) == '1' ) left [ i ] = left [ i - 1 ] + 1 ; else left [ i ] = 0 ; } for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( s . charAt ( i ) == '1' ) right [ i ] = right [ i + 1 ] + 1 ; else right [ i ] = 0 ; } for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( s . charAt ( i ) == '0' ) { int sum = left [ i - 1 ] + right [ i + 1 ] ; if ( sum < cnt_one ) max_cnt = Math . max ( max_cnt , sum + 1 ) ; else max_cnt = Math . max ( max_cnt , sum ) ; } } return max_cnt ; } public static void main ( String [ ] args ) { String s = "111011101" ; System . out . println ( maximum_one ( s , s . length ( ) ) ) ; } }

Index/key variables: i, n
Accumulator variables: cnt_one, i, temp
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static String MaxFreq ( String str ) { int n = str . length ( ) ; Map < String , Integer > mp = new HashMap < String , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String s = " " ; for ( int j = i ; j < n ; j ++ ) { s += str . charAt ( j ) ; if ( mp . containsKey ( s ) ) { mp . put ( s , mp . get ( s ) + 1 ) ; } else { mp . put ( s , 1 ) ; } } } int maxi = 0 ; String s = " " ; for ( Map . Entry < String , Integer > i : mp . entrySet ( ) ) { if ( i . getValue ( ) > maxi ) { maxi = i . getValue ( ) ; s = i . getKey ( ) ; } else if ( i . getValue ( ) == maxi ) { String ss = i . getKey ( ) ; if ( ss . length ( ) > s . length ( ) ) s = ss ; } } return s ; } public static void main ( String [ ] args ) { String str = " ababecdecd " ; System . out . print ( MaxFreq ( str ) ) ; } }

Accumulator variables: i, j, s
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int maxFreq ( String s , int a , int b ) { int fre [ ] = new int [ 10 ] ; int n = s . length ( ) ; if ( a > b ) { int temp = a ; a = b ; b = temp ; } for ( int i = 0 ; i < n ; i ++ ) fre [ s . charAt ( i ) - '0' ] ++ ; if ( fre [ a ] == 0 && fre [ b ] == 0 ) return - 1 ; else if ( fre [ a ] >= fre [ b ] ) return a ; else return b ; } public static void main ( String [ ] args ) { int a = 4 , b = 7 ; String s = "47744" ; System . out . print ( maxFreq ( s , a , b ) ) ; } }

Index/key variables: a, b
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class solution { static void convert ( int n , String a , String b ) { int [ ] l = new int [ n ] ; int i ; for ( i = 0 ; i < n ; i ++ ) l [ i ] = 0 ; for ( i = 0 ; i < n ; i ++ ) { if ( a . charAt ( i ) != b . charAt ( i ) ) l [ i ] = 1 ; } int cc = 0 ; int vl = 0 ; for ( i = 0 ; i < n ; i ++ ) { if ( l [ i ] == 0 ) { if ( vl != 0 ) cc += 1 ; vl = 0 ; } else vl += 1 ; } if ( vl != 0 ) cc += 1 ; System . out . println ( cc ) ; } public static void main ( String args [ ] ) { String a = "101010" ; String b = "110011" ; int n = a . length ( ) ; convert ( n , a , b ) ; } }

Index/key variables: i, n
Accumulator variables: cc, i, vl
Iterator variables: i
Class/struct names: solution
Java program:
import java . util . * ; class GFG { static void StringMatch ( String s ) { int lo = 0 , hi = s . length ( ) , len = s . length ( ) ; Vector < Integer > ans = new Vector < > ( ) ; for ( int x = 0 ; x < len ; x ++ ) { if ( s . charAt ( x ) == ' I ' ) { ans . add ( lo ) ; lo += 1 ; } else { ans . add ( hi ) ; hi -= 1 ; } } ans . add ( lo ) ; System . out . print ( " [ " ) ; for ( int i = 0 ; i < ans . size ( ) ; i ++ ) { System . out . print ( ans . get ( i ) ) ; if ( i != ans . size ( ) - 1 ) System . out . print ( " , " ) ; } System . out . print ( " ] " ) ; } public static void main ( String [ ] args ) { String S = " IDID " ; StringMatch ( S ) ; } }

Accumulator variables: hi, i, lo, x
Iterator variables: i, x
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int countWays ( String s1 , String s2 , int n ) { int a , b , c , d ; a = b = c = d = 0 ; int result = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s2 . charAt ( i ) == '0' ) { if ( s1 . charAt ( i ) == '0' ) { c ++ ; } else { d ++ ; } } else { if ( s1 . charAt ( i ) == '0' ) { a ++ ; } else { b ++ ; } } } result = a * d + b * c + c * d ; return result ; } public static void main ( String [ ] args ) { int n = 5 ; String s1 = "01011" ; String s2 = "11001" ; System . out . println ( countWays ( s1 , s2 , n ) ) ; } }

Accumulator variables: a, b, c, d, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GfG { static int returnWinner ( String s , int l ) { int freq [ ] = new int [ 26 ] ; for ( int i = 0 ; i < l ; i ++ ) { freq [ s . charAt ( i ) - ' a ' ] ++ ; } int cnt = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( freq [ i ] % 2 != 0 ) cnt ++ ; } if ( ( cnt == 0 ) || ( cnt & 1 ) == 1 ) return 1 ; else return 2 ; } public static void main ( String [ ] args ) { String s = " abaaab " ; int l = s . length ( ) ; int winner = returnWinner ( s , l ) ; System . out . println ( " Player - " + winner ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GfG
Java program:
import java . io . * ; class GFG { static void maxProductSum ( String str , int m ) { int n = str . length ( ) ; int maxProd = Integer . MIN_VALUE , maxSum = Integer . MIN_VALUE ; for ( int i = 0 ; i <= n - m ; i ++ ) { int product = 1 , sum = 0 ; for ( int j = i ; j < m + i ; j ++ ) { product = product * ( str . charAt ( j ) - '0' ) ; sum = sum + ( str . charAt ( j ) - '0' ) ; } maxProd = Math . max ( maxProd , product ) ; maxSum = Math . max ( maxSum , sum ) ; } System . out . println ( " Maximum ▁ Product ▁ = ▁ " + maxProd ) ; System . out . print ( " Maximum Sum = " + maxSum); } public static void main ( String [ ] args ) { String str = "3605356297" ; int m = 3 ; maxProductSum ( str , m ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class Solution { static boolean isVowel ( char ch ) { if ( ch != ' a ' && ch != ' e ' && ch != ' i ' && ch != ' o ' && ch != ' u ' ) return false ; return true ; } static String replacingConsonants ( String s ) { for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( isVowel ( s . charAt ( i ) ) ) continue ; else { if ( s . charAt ( i ) > ' a ' && s . charAt ( i ) < ' e ' ) { if ( Math . abs ( s . charAt ( i ) - ' a ' ) > Math . abs ( s . charAt ( i ) - ' e ' ) ) s = s . substring ( 0 , i ) + ' e ' + s . substring ( i + 1 ) ; else s = s . substring ( 0 , i ) + ' a ' + s . substring ( i + 1 ) ; } else if ( s . charAt ( i ) > ' e ' && s . charAt ( i ) < ' i ' ) { if ( Math . abs ( s . charAt ( i ) - ' e ' ) > Math . abs ( s . charAt ( i ) - ' i ' ) ) s = s . substring ( 0 , i ) + ' i ' + s . substring ( i + 1 ) ; else s = s . substring ( 0 , i ) + ' e ' + s . substring ( i + 1 ) ; } else if ( s . charAt ( i ) > ' i ' && s . charAt ( i ) < ' o ' ) { if ( Math . abs ( s . charAt ( i ) - ' i ' ) > Math . abs ( s . charAt ( i ) - ' o ' ) ) s = s . substring ( 0 , i ) + ' o ' + s . substring ( i + 1 ) ; else s = s . substring ( 0 , i ) + ' i ' + s . substring ( i + 1 ) ; } else if ( s . charAt ( i ) > ' o ' && s . charAt ( i ) < ' u ' ) { if ( Math . abs ( s . charAt ( i ) - ' o ' ) > Math . abs ( s . charAt ( i ) - ' u ' ) ) s = s . substring ( 0 , i ) + ' u ' + s . substring ( i + 1 ) ; else s = s . substring ( 0 , i ) + ' o ' + s . substring ( i + 1 ) ; } else if ( s . charAt ( i ) > ' u ' ) s = s . substring ( 0 , i ) + ' u ' + s . substring ( i + 1 ) ; } } return s ; } public static void main ( String args [ ] ) { String s = " geeksforgeeks " ; System . out . print ( replacingConsonants ( s ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: Solution
Java program:
public class GFG { static int maxLength ( String s , int n ) { int right = 0 , left = 0 ; int coun = 0 , max_length = Integer . MIN_VALUE ; s = s + '1' ; for ( int i = 0 ; i <= n ; i ++ ) { if ( s . charAt ( i ) == ' o ' ) coun ++ ; else { if ( coun > max_length ) { right = 0 ; left = 0 ; if ( s . charAt ( i ) == ' x ' ) right = 1 ; if ( ( ( i - coun ) > 0 ) && ( s . charAt ( i - coun - 1 ) == ' x ' ) ) left = 1 ; coun = ( int ) Math . ceil ( ( double ) coun / ( right + left ) ) ; max_length = Math . max ( max_length , coun ) ; } coun = 0 ; } } return max_length ; } public static void main ( String args [ ] ) { String s = " oooxoooooooooxooo " ; int n = s . length ( ) ; System . out . println ( maxLength ( s , n ) ) ; } }

Accumulator variables: coun, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static String printLargestString ( String s , int l , int r ) { int freq [ ] = new int [ 26 ] ; l -- ; r -- ; for ( int i = Math . min ( l , r ) ; i <= Math . max ( l , r ) ; i ++ ) { freq [ s . charAt ( i ) - ' a ' ] ++ ; } String ans = " " ; for ( int i = 25 ; i >= 0 ; i -- ) { while ( freq [ i ] > 0 ) { ans += ( char ) ( ' a ' + i ) ; freq [ i ] -- ; } } return ans ; } public static void main ( String [ ] args ) { String s = " striver " ; int l = 3 , r = 5 ; System . out . println ( printLargestString ( s , l , r ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i, l, r
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void arrange ( String s ) { int cc = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '1' ) cc ++ ; } int [ ] a = new int [ s . length ( ) + 1 ] ; int qq [ ] [ ] = { { 2 , 3 } , { 5 , 5 } } ; int n = qq . length ; for ( int i = 0 ; i < n ; i ++ ) { int l = qq [ i ] [ 0 ] , r = qq [ i ] [ 1 ] ; l -- ; r -- ; a [ l ] ++ ; a [ r + 1 ] -- ; } int len_a = a . length ; for ( int i = 1 ; i < len_a ; i ++ ) { a [ i ] += a [ i - 1 ] ; } int [ ] zz = new int [ s . length ( ) ] ; for ( int i = 0 ; i < len_a - 1 ; i ++ ) { if ( a [ i ] > 0 ) { if ( cc > 0 ) { zz [ i ] = 1 ; cc -- ; } else break ; } if ( cc == 0 ) break ; } if ( cc > 0 ) { for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( zz [ i ] == 0 ) { zz [ i ] = 1 ; cc -- ; } if ( cc == 0 ) break ; } } for ( int i = 0 ; i < s . length ( ) ; i ++ ) System . out . print ( zz [ i ] ) ; System . out . println ( ) ; } public static void main ( String [ ] args ) { String str = "11100" ; arrange ( str ) ; } }

Index/key variables: i, l
Accumulator variables: cc, i, l, r
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean areVowelsInOrder ( String s ) { int n = s . length ( ) ; char c = ( char ) 64 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == ' a ' || s . charAt ( i ) == ' e ' || s . charAt ( i ) == ' i ' || s . charAt ( i ) == ' o ' || s . charAt ( i ) == ' u ' ) { if ( s . charAt ( i ) < c ) return false ; else { c = s . charAt ( i ) ; } } } return true ; } public static void main ( String [ ] args ) { String s = " aabbbddeecc " ; if ( areVowelsInOrder ( s ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static String newString ( String s ) { int l = s . length ( ) ; int freq [ ] = new int [ 26 ] ; for ( int i = 0 ; i < l ; i ++ ) { freq [ s . charAt ( i ) - ' a ' ] += 1 ; } String ans = " " ; for ( int i = 0 ; i < 26 ; i ++ ) { for ( int j = 0 ; j < freq [ i ] ; j ++ ) { ans += ( char ) ( 97 + i ) ; } } return ans ; } public static void main ( String args [ ] ) { String s = " aabab " ; System . out . println ( newString ( s ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int Remainder ( String str , int R ) { int len = str . length ( ) ; int Num , Rem = 0 ; for ( int i = 0 ; i < len ; i ++ ) { Num = Rem * 10 + ( str . charAt ( i ) - '0' ) ; Rem = Num % R ; } return Rem ; } public static void main ( String [ ] args ) { String str = "13589234356546756" ; int R = 13 ; System . out . println ( Remainder ( str , R ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static void countWays ( int a [ ] , int n ) { int i , j ; long suff [ ] = new long [ n ] ; if ( a [ n - 1 ] == 2 ) suff [ n - 1 ] = 1 ; for ( i = n - 2 ; i >= 0 ; i -- ) { if ( a [ i ] == 2 ) suff [ i ] = suff [ i + 1 ] + 1 ; else suff [ i ] = suff [ i + 1 ] ; } long ss = 0 ; for ( i = 0 ; i < n ; i ++ ) { if ( a [ i ] == 1 ) ss += suff [ i ] ; } for ( i = 0 ; i < n ; i ++ ) { for ( j = i + 1 ; j < n ; j ++ ) { if ( a [ i ] == 1 && a [ j ] == 1 && suff [ j ] >= 2 ) { ss += ( suff [ j ] ) * ( suff [ j ] - 1 ) / 2 ; } } } for ( i = 0 ; i < n ; i ++ ) { for ( j = i + 1 ; j < n ; j ++ ) { if ( a [ i ] == 1 && a [ j ] == 1 && ( suff [ i ] - suff [ j ] ) >= 1 && suff [ j ] >= 1 ) { ss += ( suff [ i ] - suff [ j ] ) * suff [ j ] ; } } } System . out . println ( ss ) ; } public static void main ( String [ ] args ) { int a [ ] = { 1 , 2 , 1 , 1 , 2 , 2 } ; int n = 6 ; countWays ( a , n ) ; } }

Index/key variables: i, j, n
Accumulator variables: i, j, ss
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int count_carry ( String a , String b ) { int carry = 0 ; int count = 0 ; int len_a = a . length ( ) , len_b = b . length ( ) ; while ( len_a != 0 len_b != 0 ) { int x = 0 , y = 0 ; if ( len_a > 0 ) { x = a . charAt ( len_a - 1 ) - '0' ; len_a -- ; } if ( len_b > 0 ) { y = b . charAt ( len_b - 1 ) - '0' ; len_b -- ; } int sum = x + y + carry ; if ( sum >= 10 ) { carry = 1 ; count ++ ; } else carry = 0 ; } return count ; } public static void main ( String [ ] args ) { String a = "9555" , b = "555" ; int count = count_carry ( a , b ) ; if ( count == 0 ) System . out . println ( "0NEW_LINE"); else if ( count == 1 ) System . out . println ( "1NEW_LINE"); else System . out . println ( count ) ; } }

Accumulator variables: count, len_a, len_b
Class/struct names: GFG
Java program:
class GFG { static void printIndex ( String str , String s ) { boolean flag = false ; for ( int i = 0 ; i < str . length ( ) - s . length ( ) + 1 ; i ++ ) { if ( str . substring ( i , i + s . length ( ) ) . equals ( s ) ) { System . out . print ( i + " ▁ " ) ; flag = true ; } } if ( flag == false ) { System . out . println ( " NONE " ) ; } } public static void main ( String [ ] args ) { String str1 = " GeeksforGeeks " ; String str2 = " Geeks " ; printIndex ( str1 , str2 ) ; } }

Accumulator variables: i
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
Java program:
public class mergeString { public static String merge ( String s1 , String s2 ) { StringBuilder result = new StringBuilder ( ) ; for ( int i = 0 ; i < s1 . length ( ) || i < s2 . length ( ) ; i ++ ) { if ( i < s1 . length ( ) ) result . append ( s1 . charAt ( i ) ) ; if ( i < s2 . length ( ) ) result . append ( s2 . charAt ( i ) ) ; } return result . toString ( ) ; } public static void main ( String [ ] args ) { String s1 = " geeks " ; String s2 = " forgeeks " ; System . out . println ( merge ( s1 , s2 ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: mergeString
Java program:
class GFG { static char getMaxOccurringChar ( char str [ ] ) { int freq [ ] = new int [ 26 ] ; int max = - 1 ; char result = 0 ; int len = str . length ; for ( int i = 0 ; i < len ; i ++ ) { if ( str [ i ] != ' ▁ ' ) { freq [ str [ i ] - ' a ' ] ++ ; } } for ( int i = 0 ; i < 26 ; i ++ ) { if ( max < freq [ i ] ) { max = freq [ i ] ; result = ( char ) ( i + ' a ' ) ; } } return result ; } public static void main ( String [ ] args ) { char str [ ] = " sample ▁ program " . toCharArray ( ) ; System . out . println ( " Maximum ▁ occurring ▁ character ▁ = ▁ " + getMaxOccurringChar ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class new_file { static boolean isGreaterThanEqual ( String s1 , String s2 ) { if ( s1 . length ( ) > s2 . length ( ) ) return true ; if ( s1 . compareTo ( s2 ) == 0 ) return true ; return false ; } static String multiply ( String s1 , String s2 ) { int n = s1 . length ( ) ; int m = s2 . length ( ) ; int [ ] result = new int [ n + m ] ; for ( int i = n - 1 ; i >= 0 ; i -- ) for ( int j = m - 1 ; j >= 0 ; j -- ) result [ i + j + 1 ] += ( s1 . charAt ( i ) - '0' ) * ( s2 . charAt ( j ) - '0' ) ; int size = result . length ; for ( int i = size - 1 ; i > 0 ; i -- ) { if ( result [ i ] >= 10 ) { result [ i - 1 ] += result [ i ] / 10 ; result [ i ] = result [ i ] % 10 ; } } int i = 0 ; while ( i < size && result [ i ] == 0 ) i ++ ; if ( i == size ) return "0" ; String temp = " " ; while ( i < size ) { temp += Integer . toString ( result [ i ] ) ; i ++ ; } return temp ; } static String removeLeadingZeores ( String s ) { int n = s . length ( ) ; int i = 0 ; while ( i < n && s . charAt ( i ) == '0' ) i ++ ; if ( i == n ) return "0" ; String temp = " " ; while ( i < n ) { temp += s . charAt ( i ) ; i ++ ; } return temp ; } static boolean isPower ( String s1 , String s2 ) { s1 = removeLeadingZeores ( s1 ) ; s2 = removeLeadingZeores ( s2 ) ; if ( s1 == "0" s2 == "0" ) return false ; if ( s1 == "1" && s2 == "1" ) return true ; if ( s1 == "1" s2 == "1" ) return true ; if ( s1 . length ( ) > s2 . length ( ) ) return isPower ( s2 , s1 ) ; String temp = new String ( s1 ) ; while ( ! isGreaterThanEqual ( s1 , s2 ) ) s1 = multiply ( s1 , temp ) ; if ( s1 . compareTo ( s2 ) == 0 ) return true ; return false ; } public static void main ( String [ ] args ) { String s1 = "374747" , s2 = "52627712618930723" ; if ( isPower ( s1 , s2 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; s1 = "4099" ; s2 = "2" ; if ( isPower ( s1 , s2 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i, j, temp
Iterator variables: i, j
Class/struct names: new_file