dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; class GFG { static String decimalToBinary ( int N ) { String ans = " " ; while ( N > 0 ) { if ( N % 2 == 1 ) { ans = '1' + ans ; } else { ans = '0' + ans ; } N /= 2 ; } return ans ; } static String checkBinaryString ( String str , int N ) { int [ ] map = new int [ N + 10 ] ; int cnt = 0 ; for ( int i = N ; i > 0 ; i -- ) { if ( map [ i ] == 0 ) { int t = i ; String s = decimalToBinary ( t ) ; if ( str . contains ( s ) ) { while ( t > 0 && map [ t ] == 0 ) { map [ t ] = 1 ; cnt ++ ; t >>= 1 ; } } } } for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == '0' ) { cnt ++ ; break ; } } if ( cnt == N + 1 ) return " True " ; else return " False " ; } public static void main ( String [ ] args ) { String str = "0110" ; int N = 3 ; System . out . print ( checkBinaryString ( str , N ) ) ; } }

Index/key variables: i, t
Accumulator variables: N, cnt, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { private static String largestAnagramGrp ( String arr [ ] ) { int prime [ ] = { 2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29 , 31 , 37 , 41 , 43 , 47 , 53 , 59 , 61 , 67 , 71 , 73 , 79 , 83 , 89 , 97 , 101 } ; int max = - 1 ; long maxpdt = - 1 ; HashMap < Long , String > W = new HashMap < > ( ) ; HashMap < Long , Integer > P = new HashMap < > ( ) ; for ( String temp : arr ) { char c [ ] = temp . toCharArray ( ) ; long pdt = 1 ; for ( char t : c ) { pdt *= prime [ t - ' a ' ] ; } if ( P . containsKey ( pdt ) ) { P . put ( pdt , P . get ( pdt ) + 1 ) ; } else { W . put ( pdt , temp ) ; P . put ( pdt , 1 ) ; } } for ( Map . Entry < Long , Integer > e : P . entrySet ( ) ) { if ( max < e . getValue ( ) ) { max = e . getValue ( ) ; maxpdt = e . getKey ( ) ; } } return W . get ( maxpdt ) ; } public static void main ( String args [ ] ) { String S = " please ▁ be ▁ silent ▁ and ▁ listen " + " ▁ to ▁ what ▁ the ▁ professor ▁ says ▁ " ; String arr [ ] = S . split ( " [ ▁ ] + " ) ; System . out . println ( largestAnagramGrp ( arr ) ) ; } }

Accumulator variables: pdt
Iterator variables: t, temp
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static String print_next_vovel_String ( char [ ] str ) { HashMap < Character , Integer > m = new HashMap < Character , Integer > ( ) ; m . put ( ' a ' , 0 ) ; m . put ( ' e ' , 1 ) ; m . put ( ' i ' , 2 ) ; m . put ( ' o ' , 3 ) ; m . put ( ' u ' , 4 ) ; char arr [ ] = { ' a ' , ' e ' , ' i ' , ' o ' , ' u ' } ; int N = str . length ; for ( int i = 0 ; i < N ; i ++ ) { char c = str [ i ] ; if ( c == ' a ' c == ' e ' c == ' i ' c == ' o ' c == ' u ' ) { int index = m . get ( c ) + 1 ; int newindex = index % 5 ; str [ i ] = arr [ newindex ] ; } } return String . valueOf ( str ) ; } public static void main ( String [ ] args ) { String str = " geeksforgeeks " ; System . out . print ( print_next_vovel_String ( str . toCharArray ( ) ) ) ; } }

Index/key variables: i, newindex
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isPalindrome ( String str ) { int len = str . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( str . charAt ( i ) != str . charAt ( len - i - 1 ) ) return false ; } return true ; } static boolean isCompressablePalindrome ( String str ) { int len = str . length ( ) ; String compressed = " " ; compressed = String . valueOf ( str . charAt ( 0 ) ) ; for ( int i = 1 ; i < len ; i ++ ) { if ( str . charAt ( i ) != str . charAt ( i - 1 ) ) compressed += str . charAt ( i ) ; } return isPalindrome ( compressed ) ; } public static void main ( String [ ] args ) { String str = " abbcbbbaaa " ; if ( isCompressablePalindrome ( str ) ) System . out . print ( "YesNEW_LINE"); else System . out . print ( "NoNEW_LINE"); } }

Accumulator variables: compressed, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; public class GFG { static boolean isvowel ( char x ) { return ( x == ' a ' x == ' e ' x == ' i ' x == ' o ' x == ' u ' ) ; } static int CountTotal ( String str ) { int ans = 0 ; int n = str . length ( ) ; char [ ] s = str . toCharArray ( ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( isvowel ( s [ i ] ) ) cnt += 1 ; else { ans += ( cnt * ( cnt + 1 ) / 2 ) ; cnt = 0 ; } } if ( cnt != 0 ) ans += ( cnt * ( cnt + 1 ) / 2 ) ; return ans ; } static public void main ( String [ ] args ) { String s = " geeksforgeeks " ; System . out . println ( CountTotal ( s ) ) ; } }

Index/key variables: i
Accumulator variables: ans, cnt, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int totCount ; static int firstCount ; static void getTotCount ( int num ) { totCount = 1 ; firstCount = 1 ; int temp = 1 ; while ( ( num & temp ) == 0 ) { temp = temp << 1 ; totCount += 1 ; } firstCount = totCount ; temp = num >> totCount ; while ( temp != 0 ) { totCount += 1 ; temp = temp >> 1 ; } } static int flipBitsFromRightMostSetBit ( int num ) { getTotCount ( num ) ; int num1 = num ^ ( ( 1 << totCount ) - 1 ) ; num1 = num1 ^ ( ( 1 << firstCount ) - 1 ) ; return num1 ; } public static void main ( String [ ] args ) { int n = 120 ; System . out . println ( flipBitsFromRightMostSetBit ( n ) ) ; } }

Accumulator variables: totCount
Class/struct names: GFG
Java program:
public class GFG { static boolean isVowel ( char x ) { return ( x == ' a ' x == ' e ' x == ' i ' x == ' o ' x == ' u ' ) ; } static int findMaxLen ( String s ) { int maxLen = 0 ; int cur ; if ( isVowel ( s . charAt ( 0 ) ) ) maxLen = 1 ; cur = maxLen ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { if ( isVowel ( s . charAt ( i ) ) ) { if ( s . charAt ( i ) != s . charAt ( i - 1 ) ) cur += 1 ; else cur = 1 ; } else { cur = 0 ; } maxLen = Math . max ( cur , maxLen ) ; } return maxLen ; } public static void main ( String [ ] args ) { String Str = " aeoibsddaeiouudb " ; System . out . println ( findMaxLen ( Str ) ) ; } }

Accumulator variables: cur, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static long power ( long base , long pow ) { long res = 1 ; while ( pow > 0 ) { if ( ( pow & 1 ) == 1 ) res = ( res * base ) ; base = ( base * base ) ; pow >>= 1 ; } return res ; } static long countNonPalindromicString ( long n , long m ) { long total = power ( n , m ) ; long palindrome = power ( n , m / 2 + m % 2 ) ; long count = total - palindrome ; return count ; } public static void main ( String [ ] args ) { int n = 3 , m = 5 ; System . out . println ( countNonPalindromicString ( n , m ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int [ ] freq = new int [ 26 ] ; static boolean checkPalindrome ( ) { int oddCnt = 0 ; for ( int x : freq ) { if ( x % 2 == 1 ) oddCnt ++ ; } return oddCnt <= 1 ; } static int countPalindromePermutation ( char [ ] s , int k ) { for ( int i = 0 ; i < k ; i ++ ) { freq [ s [ i ] - 97 ] ++ ; } int ans = 0 ; if ( checkPalindrome ( ) ) { ans ++ ; } int i = 0 , j = k ; while ( j < s . length ) { freq [ s [ i ++ ] - 97 ] -- ; freq [ s [ j ++ ] - 97 ] ++ ; if ( checkPalindrome ( ) ) { ans ++ ; } } return ans ; } public static void main ( String [ ] args ) { String str = " abbaca " ; int K = 3 ; System . out . print ( countPalindromePermutation ( str . toCharArray ( ) , K ) + "NEW_LINE"); } }

Index/key variables: i
Accumulator variables: ans, i, j, oddCnt
Iterator variables: i, x
Class/struct names: GFG
Java program:
import java . util . Arrays ; public class GFG { public static int minFlips ( String target ) { char curr = '1' ; int count = 0 ; for ( int i = 0 ; i < target . length ( ) ; i ++ ) { if ( target . charAt ( i ) == curr ) { count ++ ; curr = ( char ) ( 48 + ( curr + 1 ) % 2 ) ; } } return count ; } public static void main ( String args [ ] ) { String S = "011000" ; System . out . println ( minFlips ( S ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean checkSuffix ( int A , int B ) { int digit_B = ( int ) ( Math . log10 ( B ) + 1 ) ; A -= B ; return ( A % ( int ) ( Math . pow ( 10 , digit_B ) ) > 0 ) ; } public static void main ( String [ ] args ) { int A = 12345 , B = 45 ; boolean result = checkSuffix ( A , B ) ; if ( ! result ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }

Accumulator variables: A
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; class GFG { static int count_min_length ( String s ) { int [ ] hash = new int [ 26 ] ; int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < 26 ; i ++ ) hash [ i ] = - 1 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( hash [ s . charAt ( i ) - ' a ' ] == - 1 ) hash [ s . charAt ( i ) - ' a ' ] = i ; else { if ( hash [ s . charAt ( i ) - ' a ' ] == i - 1 || hash [ s . charAt ( i ) - ' a ' ] == i - 2 ) return 0 ; ans = Math . min ( ans , i - hash [ s . charAt ( i ) - ' a ' ] - 1 ) ; hash [ s . charAt ( i ) - ' a ' ] = i ; } } if ( ans == Integer . MAX_VALUE ) return - 1 ; return ans ; } public static void main ( String [ ] args ) { String str = " abcdeba " ; System . out . println ( count_min_length ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void RemoveHTMLTags ( String str ) { str = str . replaceAll ( " \\ < . * ? \\ > " , " " ) ; System . out . println ( str ) ; } public static void main ( String [ ] args ) { String str ; str = " < div > < b > Geeks ▁ for ▁ Geeks < / b > < / div > " ; RemoveHTMLTags ( str ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; public class Main { static class TreeNode { public TreeNode parent = null ; public Vector < TreeNode > children = new Vector < TreeNode > ( ) ; public void addChild ( TreeNode node ) { children . add ( node ) ; } public void setParent ( TreeNode node ) { parent = node ; } public TreeNode getParent ( ) { return parent ; } public int computeScore ( ) { if ( children . size ( ) == 0 ) return 1 ; int res = 0 ; for ( TreeNode curr : children ) res += curr . computeScore ( ) ; if ( parent == null ) return res ; else return 2 * res ; } } static TreeNode computeTree ( String s ) { TreeNode current = new TreeNode ( ) ; TreeNode root = current ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' ( ' ) { TreeNode child = new TreeNode ( ) ; child . setParent ( current ) ; current . addChild ( child ) ; current = child ; } else { current = current . getParent ( ) ; } } return root ; } public static void main ( String [ ] args ) { String s = " ( ( ) ( ( ) ) ) " ; TreeNode root = computeTree ( s ) ; System . out . print ( root . computeScore ( ) ) ; } }

Accumulator variables: i, res
Iterator variables: curr, i
Class/struct names: Main, TreeNode
Java program:
import java . util . * ; class Main { public static void rec ( char a [ ] , int i ) { if ( i == 0 ) { System . out . println ( a ) ; return ; } if ( a [ i ] == ' x ' ) { int j = i ; while ( a [ j ] != ' \0' && a [ j + 1 ] != ' \0' ) { char temp = a [ j ] ; a [ j ] = a [ j + 1 ] ; a [ j + 1 ] = temp ; j ++ ; } } rec ( a , i - 1 ) ; } public static void main ( String [ ] args ) { char a [ ] = { ' g ' , ' e ' , ' e ' , ' k ' , ' x ' , ' s ' , ' x ' , ' x ' , ' k ' , ' s ' , ' \0' } ; int n = 10 ; rec ( a , n - 1 ) ; } }

Index/key variables: i, j
Accumulator variables: j
Class/struct names: Main
Java program:
public class Main { public static String largestCharacter ( String str ) { boolean [ ] uppercase = new boolean [ 26 ] ; boolean [ ] lowercase = new boolean [ 26 ] ; char [ ] arr = str . toCharArray ( ) ; for ( char c : arr ) { if ( Character . isLowerCase ( c ) ) lowercase = true ; if ( Character . isUpperCase ( c ) ) uppercase = true ; } for ( int i = 25 ; i >= 0 ; i -- ) { if ( uppercase [ i ] && lowercase [ i ] ) return ( char ) ( i + ' A ' ) + " " ; } return " - 1" ; } public static void main ( String [ ] args ) { String str = " admeDCAB " ; System . out . println ( largestCharacter ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: c, i
Boolean variables: lowercase, uppercase
Class/struct names: Main
Java program:
import java . util . * ; class GFG { static String generateString ( int N , int M , int K ) { String s = " " ; int cnt1 = 0 ; int cnt2 = 0 ; for ( int i = 0 ; i < N ; i ++ ) { cnt1 ++ ; cnt2 ++ ; if ( cnt1 <= M ) { if ( cnt2 <= K ) { s = s + ( char ) ( 96 + cnt1 ) ; } else { s = s + ' a ' ; } } else { cnt1 = 1 ; cnt2 = 1 ; s = s + ' a ' ; } } return s ; } public static void main ( String [ ] args ) { int N = 7 , M = 5 , K = 3 ; System . out . println ( generateString ( N , M , K ) ) ; } }

Accumulator variables: cnt1, cnt2, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void finalString ( String str ) { int x = 0 , y = 0 ; int left ; int n = str . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( str . charAt ( i ) == '1' ) x ++ ; else y ++ ; } if ( x > y ) left = 1 ; else left = 0 ; int length = n - 2 * Math . min ( x , y ) ; for ( int i = 0 ; i < length ; i ++ ) { System . out . print ( left ) ; } } public static void main ( String [ ] args ) { String str = "010110100100000" ; finalString ( str ) ; } }

Accumulator variables: i, x, y
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void printPalindrome ( Vector < String > left , String mid , Vector < String > right ) { for ( String x : left ) System . out . print ( x ) ; System . out . print ( mid ) ; Collections . reverse ( right ) ; for ( String x : right ) System . out . print ( x ) ; System . out . println ( ) ; } static void findPalindrome ( Vector < String > S , int N , int M ) { HashSet < String > dict = new HashSet < String > ( ) ; for ( int i = 0 ; i < M ; i ++ ) { dict . add ( S . get ( i ) ) ; } Vector < String > left = new Vector < String > ( ) , right = new Vector < String > ( ) ; String mid = " " ; for ( int i = 0 ; i < N ; i ++ ) { String t = S . get ( i ) ; t = reverse ( t ) ; if ( t == S . get ( i ) ) mid = t ; else if ( dict . contains ( t ) ) { left . add ( S . get ( i ) ) ; right . add ( t ) ; dict . remove ( S . get ( i ) ) ; dict . remove ( t ) ; } } printPalindrome ( left , mid , right ) ; } static String reverse ( String input ) { char [ ] a = input . toCharArray ( ) ; int l , r = a . length - 1 ; for ( l = 0 ; l < r ; l ++ , r -- ) { char temp = a [ l ] ; a [ l ] = a [ r ] ; a [ r ] = temp ; } return String . valueOf ( a ) ; } public static void main ( String [ ] args ) { String arr [ ] = { " tab " , " one " , " bat " } ; Vector < String > S = new Vector < String > ( Arrays . asList ( arr ) ) ; int M = 3 ; int N = S . size ( ) ; findPalindrome ( S , N , M ) ; } }

Index/key variables: l, r
Accumulator variables: i, l, r
Iterator variables: i, l, x
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static String swap ( String str , int i , int j ) { char [ ] tempArr = str . toCharArray ( ) ; char temp = tempArr [ i ] ; tempArr [ i ] = tempArr [ j ] ; tempArr [ j ] = temp ; return String . valueOf ( tempArr ) ; } static boolean IsLexicographicallySmaller ( String A , String B ) { if ( A . compareTo ( B ) < 0 ) { return true ; } String temp = A ; char p [ ] = temp . toCharArray ( ) ; Arrays . sort ( p ) ; temp = String . valueOf ( p ) ; int index = - 1 ; for ( int i = 0 ; i < A . length ( ) ; i ++ ) { if ( A . charAt ( i ) != temp . charAt ( i ) ) { index = i ; break ; } } if ( index == - 1 ) { return false ; } int j = 0 ; for ( int i = 0 ; i < A . length ( ) ; i ++ ) { if ( A . charAt ( i ) == temp . charAt ( index ) ) j = i ; } A = swap ( A , index , j ) ; if ( A . compareTo ( B ) < 0 ) { return true ; } else { return false ; } } public static void main ( String args [ ] ) { String A = " AGAIN " ; String B = " ACTION " ; if ( IsLexicographicallySmaller ( A , B ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Index/key variables: i, j
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int max ( int x , int y ) { return ( x > y ) ? x : y ; } static int longestPalindromic ( String str , int i , int j , int count ) { if ( i > j ) return count ; if ( i == j ) return ( count + 1 ) ; if ( str . charAt ( i ) == str . charAt ( j ) ) { count = longestPalindromic ( str , i + 1 , j - 1 , count + 2 ) ; return max ( count , max ( longestPalindromic ( str , i + 1 , j , 0 ) , longestPalindromic ( str , i , j - 1 , 0 ) ) ) ; } return Math . max ( longestPalindromic ( str , i + 1 , j , 0 ) , longestPalindromic ( str , i , j - 1 , 0 ) ) ; } static int longest_palindromic_substr ( String str ) { return longestPalindromic ( str , 0 , str . length ( ) - 1 , 0 ) ; } public static void main ( String [ ] args ) { String str = " aaaabbaa " ; System . out . print ( longest_palindromic_substr ( str ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static void MaxPrefix ( String s ) { Map < Character , Integer > Dict = new HashMap < > ( ) ; for ( char i : s . toCharArray ( ) ) { Dict . put ( i , Dict . getOrDefault ( i , 0 ) + 1 ) ; } int minfrequency = Integer . MAX_VALUE ; for ( Integer x : Dict . values ( ) ) { minfrequency = Math . min ( minfrequency , x ) ; } int countminFrequency = 0 ; for ( Map . Entry < Character , Integer > x : Dict . entrySet ( ) ) { if ( x . getValue ( ) == minfrequency ) countminFrequency += 1 ; } Map < Character , Integer > mapper = new HashMap < > ( ) ; int indi = 0 ; for ( char i : s . toCharArray ( ) ) { mapper . put ( i , mapper . getOrDefault ( i , 0 ) + 1 ) ; if ( mapper . get ( i ) > countminFrequency ) break ; indi += 1 ; } System . out . println ( s . substring ( 0 , indi ) ) ; } public static void main ( String [ ] args ) { String str = " aabcdaab " ; MaxPrefix ( str ) ; } }

Accumulator variables: countminFrequency, indi
Iterator variables: i, x
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int countSubString ( char [ ] S , char L [ ] , int n ) { int [ ] freq = new int [ 26 ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { freq [ ( int ) ( L [ i ] - ' a ' ) ] = 1 ; } int count = 0 ; for ( int x : S ) { if ( freq [ ( int ) ( x - ' a ' ) ] > 0 ) { ans += ( count * count + count ) / 2 ; count = 0 ; } else count ++ ; } ans += ( count * count + count ) / 2 ; return ans ; } public static void main ( String [ ] args ) { String S = " abcpxyz " ; char L [ ] = { ' a ' , ' p ' , ' q ' } ; int n = L . length ; System . out . print ( countSubString ( S . toCharArray ( ) , L , n ) ) ; } }

Index/key variables: i
Accumulator variables: ans, count, i
Iterator variables: i, x
Class/struct names: GFG
Java program:
class GFG { static int checkIfStartsWithVowels ( char [ ] str ) { if ( ! ( str [ 0 ] == ' A ' str [ 0 ] == ' a ' str [ 0 ] == ' E ' str [ 0 ] == ' e ' str [ 0 ] == ' I ' str [ 0 ] == ' i ' str [ 0 ] == ' O ' str [ 0 ] == ' o ' str [ 0 ] == ' U ' str [ 0 ] == ' u ' ) ) return 1 ; else return 0 ; } static void check ( String str ) { if ( checkIfStartsWithVowels ( str . toCharArray ( ) ) == 1 ) System . out . print ( "Not AcceptedNEW_LINE"); else System . out . print ( "AcceptedNEW_LINE"); } public static void main ( String [ ] args ) { String str = " animal " ; check ( str ) ; str = " zebra " ; check ( str ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int findNthOccur ( String str , char ch , int N ) { int occur = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == ch ) { occur += 1 ; } if ( occur == N ) return i ; } return - 1 ; } public static void main ( String [ ] args ) { String str = " geeks " ; char ch = ' e ' ; int N = 2 ; System . out . print ( findNthOccur ( str , ch , N ) ) ; } }

Accumulator variables: i, occur
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int solve ( String X , String Y , int N , int K ) { int [ ] count = new int [ N + 1 ] ; int sol = 0 ; count [ 0 ] = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { count [ i ] = count [ i - 1 ] + Math . abs ( X . charAt ( i - 1 ) - Y . charAt ( i - 1 ) ) ; } int j = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { while ( ( count [ i ] - count [ j ] ) > K ) { j ++ ; } sol = Math . max ( sol , i - j ) ; } return sol ; } public static void main ( String [ ] args ) { int N = 4 ; String X = " abcd " , Y = " bcde " ; int K = 3 ; System . out . print ( solve ( X , Y , N , K ) + "NEW_LINE"); } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static double jaro_distance ( String s1 , String s2 ) { if ( s1 == s2 ) return 1.0 ; int len1 = s1 . length ( ) , len2 = s2 . length ( ) ; if ( len1 == 0 len2 == 0 ) return 0.0 ; int max_dist = ( int ) Math . floor ( Math . max ( len1 , len2 ) / 2 ) - 1 ; int match = 0 ; int hash_s1 [ ] = new int [ s1 . length ( ) ] ; int hash_s2 [ ] = new int [ s2 . length ( ) ] ; for ( int i = 0 ; i < len1 ; i ++ ) { for ( int j = Math . max ( 0 , i - max_dist ) ; j < Math . min ( len2 , i + max_dist + 1 ) ; j ++ ) if ( s1 . charAt ( i ) == s2 . charAt ( j ) && hash_s2 [ j ] == 0 ) { hash_s1 [ i ] = 1 ; hash_s2 [ j ] = 1 ; match ++ ; break ; } } if ( match == 0 ) return 0.0 ; double t = 0 ; int point = 0 ; for ( int i = 0 ; i < len1 ; i ++ ) if ( hash_s1 [ i ] == 1 ) { while ( hash_s2 [ point ] == 0 ) point ++ ; if ( s1 . charAt ( i ) != s2 . charAt ( point ++ ) ) t ++ ; } t /= 2 ; return ( ( ( double ) match ) / ( ( double ) len1 ) + ( ( double ) match ) / ( ( double ) len2 ) + ( ( double ) match - t ) / ( ( double ) match ) ) / 3.0 ; } static double jaro_Winkler ( String s1 , String s2 ) { double jaro_dist = jaro_distance ( s1 , s2 ) ; if ( jaro_dist > 0.7 ) { int prefix = 0 ; for ( int i = 0 ; i < Math . min ( s1 . length ( ) , s2 . length ( ) ) ; i ++ ) { if ( s1 . charAt ( i ) == s2 . charAt ( i ) ) prefix ++ ; else break ; } prefix = Math . min ( 4 , prefix ) ; jaro_dist += 0.1 * prefix * ( 1 - jaro_dist ) ; } return jaro_dist ; } public static void main ( String [ ] args ) { String s1 = " TRATE " , s2 = " TRACE " ; System . out . println ( " Jaro - Winkler ▁ Similarity ▁ = " + jaro_Winkler ( s1 , s2 ) ) ; } }

Index/key variables: i, j, point
Accumulator variables: i, j, jaro_dist, match, point, prefix, t
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static boolean isWordPresent ( String sentence , String word ) { String [ ] s = sentence . split ( " ▁ " ) ; for ( String temp : s ) { if ( temp . compareTo ( word ) == 0 ) { return true ; } } return false ; } public static void main ( String [ ] args ) { String s = " Geeks ▁ for ▁ Geeks " ; String word = " Geeks " ; if ( isWordPresent ( s , word ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Iterator variables: temp
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isWordPresent ( String sentence , String word ) { word = transform ( word ) ; sentence = transform ( sentence ) ; String [ ] s = sentence . split ( " ▁ " ) ; for ( String temp : s ) { if ( temp . compareTo ( word ) == 0 ) { return true ; } } return false ; } static String transform ( String word ) { return word . toUpperCase ( ) ; } public static void main ( String [ ] args ) { String s = " Geeks ▁ for ▁ Geeks " ; String word = " geeks " ; if ( isWordPresent ( s , word ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Iterator variables: temp
Class/struct names: GFG
Java program:
class GFG { static int countChars ( String str , int n ) { int i = 0 , cnt = 0 ; while ( i < n ) { if ( str . charAt ( i ) == '0' ) i += 1 ; else i += 2 ; cnt += 1 ; } return cnt ; } public static void main ( String [ ] args ) { String str = "11010" ; int n = str . length ( ) ; System . out . println ( countChars ( str , n ) ) ; } }

Accumulator variables: cnt, i
Class/struct names: GFG