dhyuti-n/xlcost-variable-roles huggingface dataset:
Python program:
combination = " " ;
combinations = [ ] ;
def printSequences ( combinations ) :
    for s in ( combinations ) :
        print ( s , end = ' ▁ ' ) ;
def generateCombinations ( s , n ) :
    global combination ;
    for i in range ( len ( s ) ) :
        combination += s [ i ] ;
        x = int ( combination ) ;
        if ( x <= n ) :
            combinations . append ( combination ) ;
            generateCombinations ( s , n ) ;
        combination = combination [ : - 1 ] ;
if __name__ == " _ _ main _ _ " :
    S = "124" ;
    N = 100 ;
    generateCombinations ( S , N ) ;
    printSequences ( combinations ) ;

Index/key variables: i
Accumulator variables: combination, combinations
Iterator variables: i, s
Python program:
def compute_hash ( str ) :
    p = 31
    MOD = 10 ** 9 + 7
    hash_val = 0
    mul = 1
    for ch in str :
        hash_val = ( hash_val + ( ord ( ch ) - ord ( ' a ' ) + 1 ) * mul ) % MOD
        mul = ( mul * p ) % MOD
    return hash_val
def distinct_str ( arr , n ) :
    hash = [ 0 ] * ( n )
    for i in range ( n ) :
        hash [ i ] = compute_hash ( arr [ i ] )
    hash = sorted ( hash )
    cntElem = 1
    for i in range ( 1 , n ) :
        if ( hash [ i ] != hash [ i - 1 ] ) :
            cntElem += 1
    return cntElem
if __name__ == ' _ _ main _ _ ' :
    arr = [ " abcde " , " abcce " , " abcdf " , " abcde " ]
    N = len ( arr )
    print ( distinct_str ( arr , N ) )

Index/key variables: i
Accumulator variables: cntElem
Iterator variables: ch, i
Python program:
def SieveOfEratosthenes ( prime , n ) :
    for i in range ( n + 1 ) :
        prime [ i ] = True
    prime [ 0 ] = prime [ 1 ] = False
    i = 2
    while i * i <= n :
        if ( prime [ i ] == True ) :
            j = 2
            while i * j <= n :
                prime [ i * j ] = False
                j += 1
        i += 1
def removePrimeFrequencies ( s ) :
    n = len ( s )
    prime = [ False ] * ( n + 1 )
    SieveOfEratosthenes ( prime , n )
    m = { }
    for i in range ( len ( s ) ) :
        if s [ i ] in m :
            m [ s [ i ] ] += 1
        else :
            m [ s [ i ] ] = 1
    new_String = " "
    for i in range ( len ( s ) ) :
        if ( prime [ m [ s [ i ] ] ] ) :
            continue
        new_String += s [ i ]
    print ( new_String , end = " " )
Str = " geeksforgeeks "
removePrimeFrequencies ( list ( Str ) )

Index/key variables: i
Accumulator variables: j, new_String
Iterator variables: i
Python program:
def rearrange ( s ) :
    s1 = [ ]
    s2 = [ ]
    for x in s :
        if x . isalpha ( ) :
            s1 . append ( x )
        else :
            s2 . append ( x )
    n = len ( s1 )
    m = len ( s2 )
    if ( abs ( n - m ) > 1 ) :
        return " - 1"
    i = 0
    j = 0
    k = 0
    flag = 0
    if ( n >= m ) :
        flag = 1
    else :
        flag = 0
    while ( i < n and j < m ) :
        if ( flag ) :
            s [ k ] = s1 [ i ]
            k += 1
            i += 1
        else :
            s [ k ] = s2 [ j ]
            k += 1
            j += 1
        flag = not flag
    return " " . join ( s )
if __name__ == ' _ _ main _ _ ' :
    str = " geeks2020"
    str1 = [ i for i in str ]
    print ( rearrange ( str1 ) )

Index/key variables: i, j, k
Accumulator variables: s1, s2
Iterator variables: x
Python program:
def charactersCount ( str , n ) :
    count = 0 ;
    while ( n > 0 ) :
        cur = str [ 0 ] ;
        ind = 0 ;
        for j in range ( 1 , n ) :
            if ( str [ j ] < cur ) :
                cur = str [ j ] ;
                ind = j ;
        str = str [ 0 : ind ] + str [ ind + 1 : ] ;
        n -= 1 ;
        count += ind + 1 ;
    print ( count ) ;
if __name__ == ' _ _ main _ _ ' :
    str = " aabbc " ;
    n = 5 ;
    charactersCount ( str , n ) ;

Index/key variables: j
Accumulator variables: count, n
Iterator variables: j
Python program:
def printMiddleCharacter ( str ) :
    length = len ( str ) ;
    middle = length // 2 ;
    print ( str [ middle ] ) ;
str = " GeeksForGeeks " ;
printMiddleCharacter ( str ) ;

Index/key variables: middle
Python program:
def check ( s ) :
    a = set ( )
    for i in s :
        if i in a :
            return False
        a . add ( i )
    return True
def helper ( arr , ind ) :
    if ( ind == len ( arr ) ) :
        return [ " " ]
    tmp = helper ( arr , ind + 1 )
    ret = tmp
    for i in tmp :
        test = i + arr [ ind ]
        if ( check ( test ) ) :
            ret . append ( test )
    return ret
def maxLength ( arr ) :
    tmp = helper ( arr , 0 )
    l = 0
    for i in tmp :
        l = l if l > len ( i ) else len ( i )
    return l
if __name__ == ' _ _ main _ _ ' :
    s = [ ]
    s . append ( " abcdefgh " )
    print ( maxLength ( s ) )

Index/key variables: ind
Accumulator variables: a, ret
Iterator variables: i
Python program:
def Range_sum_query ( S , Query ) :
    N = len ( S )
    A = [ 0 ] * N
    A [ 0 ] = ord ( S [ 0 ] ) - ord ( ' a ' ) + 1
    for i in range ( 1 , N ) :
        A [ i ] = ord ( S [ i ] ) - ord ( ' a ' ) + 1
        A [ i ] = A [ i ] + A [ i - 1 ]
    for i in range ( len ( Query ) ) :
        if ( Query [ i ] [ 0 ] == 1 ) :
            print ( A [ Query [ i ] [ 1 ] - 1 ] )
        else :
            print ( A [ Query [ i ] [ 1 ] - 1 ] - A [ Query [ i ] [ 0 ] - 2 ] )
S = " abcd "
Query = [ ]
Query . append ( [ 2 , 4 ] )
Query . append ( [ 1 , 3 ] )
Range_sum_query ( S , Query )

Index/key variables: i
Iterator variables: i
Python program:
def largestAnagramGrp ( arr ) :
    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 ]
    max = - 1
    maxpdt = - 1
    W = { }
    P = { }
    for temp in arr :
        c = [ i for i in temp ]
        pdt = 1
        for t in c :
            pdt *= prime [ ord ( t ) - ord ( ' a ' ) ]
        if ( pdt in P ) :
            P [ pdt ] = P . get ( pdt , 0 ) + 1
        else :
            W [ pdt ] = temp
            P [ pdt ] = 1
    for e in P :
        if ( max < P [ e ] ) :
            max = P [ e ]
            maxpdt = e
    return W [ maxpdt ]
if __name__ == ' _ _ main _ _ ' :
    S = " please ▁ be ▁ silent ▁ and ▁ listen ▁ to ▁ what ▁ the ▁ professor ▁ says "
    arr = S . split ( " ▁ " )
    print ( largestAnagramGrp ( arr ) )

Index/key variables: e, maxpdt, pdt
Iterator variables: e, t, temp
Python program:
def print_next_vovel_string ( st ) :
    m = { }
    m [ ' a ' ] = 0
    m [ ' e ' ] = 1
    m [ ' i ' ] = 2
    m [ ' o ' ] = 3
    m [ ' u ' ] = 4
    arr = [ ' a ' , ' e ' , ' i ' , ' o ' , ' u ' ]
    N = len ( st )
    for i in range ( N ) :
        c = st [ i ]
        if ( c == ' a ' or c == ' e ' or c == ' i ' or c == ' o ' or c == ' u ' ) :
            index = m [ st [ i ] ] + 1
            newindex = index % 5
            st = st . replace ( st [ i ] , arr [ newindex ] , 1 )
    return st
if __name__ == " _ _ main _ _ " :
    st = " geeksforgeeks "
    print ( print_next_vovel_string ( st ) )

Index/key variables: i, newindex
Iterator variables: i
Python program:
def isPalindrome ( Str ) :
    Len = len ( Str )
    for i in range ( Len ) :
        if ( Str [ i ] != Str [ Len - i - 1 ] ) :
            return False
    return True
def isCompressablePalindrome ( Str ) :
    Len = len ( Str )
    compressed = " "
    compressed += Str [ 0 ]
    for i in range ( 1 , Len ) :
        if ( Str [ i ] != Str [ i - 1 ] ) :
            compressed += Str [ i ]
    return isPalindrome ( compressed )
if __name__ == ' _ _ main _ _ ' :
    Str = " abbcbbbaaa "
    if ( isCompressablePalindrome ( Str ) ) :
        print ( " Yes " )
    else :
        print ( " No " )

Index/key variables: i
Accumulator variables: compressed
Iterator variables: i
Python program:
def isvowel ( ch ) :
    return ( ch in " aeiou " )
def CountTotal ( s ) :
    ans = 0
    n = len ( s )
    cnt = 0
    for i in range ( 0 , n ) :
        if ( isvowel ( s [ i ] ) ) :
            cnt += 1
        else :
            ans += ( cnt * ( cnt + 1 ) // 2 )
            cnt = 0
    if ( cnt != 0 ) :
        ans += ( cnt * ( cnt + 1 ) // 2 )
    return ans
s = " geeksforgeeks "
print ( CountTotal ( s ) )

Index/key variables: i
Accumulator variables: ans, cnt
Iterator variables: i
Python program:
def getTotCount ( num ) :
    totCount = 1
    firstCount = 1
    temp = 1
    while ( not ( num & temp ) ) :
        temp = temp << 1
        totCount += 1
    firstCount = totCount
    temp = num >> totCount
    while ( temp ) :
        totCount += 1
        temp = temp >> 1
    return totCount , firstCount
def flipBitsFromRightMostSetBit ( num ) :
    totbit , firstbit = getTotCount ( num )
    num1 = num ^ ( ( 1 << totbit ) - 1 )
    num1 = num1 ^ ( ( 1 << firstbit ) - 1 )
    return num1
if __name__ == ' _ _ main _ _ ' :
    n = 120
    print ( flipBitsFromRightMostSetBit ( n ) )

Accumulator variables: totCount
Python program:
def isVowel ( x ) :
    return ( x == ' a ' or x == ' e ' or x == ' i ' or x == ' o ' or x == ' u ' ) ;
def findMaxLen ( s ) :
    maxLen = 0
    cur = 0
    if ( isVowel ( s [ 0 ] ) ) :
        maxLen = 1 ;
    cur = maxLen
    for i in range ( 1 , len ( s ) ) :
        if ( isVowel ( s [ i ] ) ) :
            if ( s [ i ] != s [ i - 1 ] ) :
                cur += 1
            else :
                cur = 1
        else :
            cur = 0 ;
        maxLen = max ( cur , maxLen ) ;
    return maxLen
Str = " aeoibsddaeiouudb "
print ( findMaxLen ( Str ) )

Index/key variables: i
Accumulator variables: cur
Iterator variables: i
Python program:
def power ( base , pwr ) :
    res = 1
    while ( pwr > 0 ) :
        if ( pwr & 1 ) :
            res = res * base
        base = base * base
        pwr >>= 1
    return res
def countNonPalindromicString ( n , m ) :
    total = power ( n , m )
    palindrome = power ( n , m // 2 + m % 2 )
    count = total - palindrome
    return count
if __name__ == ' _ _ main _ _ ' :
    n = 3
    m = 5
    print ( countNonPalindromicString ( n , m ) )

Accumulator variables: pwr
Python program:
freq = [ 0 ] * 26
def checkPalindrome ( ) :
    oddCnt = 0
    for x in freq :
        if ( x % 2 == 1 ) :
            oddCnt += 1
    return oddCnt <= 1
def countPalindromePermutation ( s , k ) :
    for i in range ( k ) :
        freq [ ord ( s [ i ] ) - 97 ] += 1
    ans = 0
    if ( checkPalindrome ( ) ) :
        ans += 1
    i = 0
    j = k
    while ( j < len ( s ) ) :
        freq [ ord ( s [ i ] ) - 97 ] -= 1
        i += 1
        freq [ ord ( s [ j ] ) - 97 ] += 1
        j += 1
        if ( checkPalindrome ( ) ) :
            ans += 1
    return ans
str = " abbaca "
K = 3
print ( countPalindromePermutation ( str , K ) )

Index/key variables: i, j
Accumulator variables: ans, oddCnt
Iterator variables: i, x
Python program:
def minFlips ( target ) :
    curr = '1'
    count = 0
    for i in range ( len ( target ) ) :
        if ( target [ i ] == curr ) :
            count += 1
            curr = chr ( 48 + ( ord ( curr ) + 1 ) % 2 )
    return count
if __name__ == " _ _ main _ _ " :
    S = "011000"
    print ( minFlips ( S ) )

Index/key variables: i
Accumulator variables: count
Iterator variables: i
Python program:
import sys
INT_MAX = sys . maxsize ;
def count_min_length ( s ) :
    hash = [ 0 ] * 26 ;
    ans = sys . maxsize ;
    for i in range ( 26 ) :
        hash [ i ] = - 1 ;
    for i in range ( len ( s ) ) :
        if ( hash [ ord ( s [ i ] ) - ord ( ' a ' ) ] == - 1 ) :
            hash [ ord ( s [ i ] ) - ord ( ' a ' ) ] = i ;
        else :
            if ( hash [ ord ( s [ i ] ) - ord ( ' a ' ) ] == i - 1 or hash [ ord ( s [ i ] ) - ord ( ' a ' ) ] == i - 2 ) :
                return 0 ;
            ans = min ( ans , i - hash [ ord ( s [ i ] ) - ord ( ' a ' ) ] - 1 ) ;
            hash [ ord ( s [ i ] ) - ord ( ' a ' ) ] = i ;
    if ( ans == INT_MAX ) :
        return - 1 ;
    return ans ;
if __name__ == " _ _ main _ _ " :
    string = " abcdeba " ;
    print ( count_min_length ( string ) ) ;

Index/key variables: i
Iterator variables: i
Python program:
class TreeNode :
    def __init__ ( self ) :
        self . parent = None
        self . children = [ ]
    def addChild ( self , node ) :
        self . children . append ( node ) ;
    def setParent ( self , node ) :
        self . parent = node ;
    def getParent ( self ) :
        return self . parent ;
    def computeScore ( self ) :
        if ( len ( self . children ) == 0 ) :
            return 1 ;
        res = 0 ;
        for curr in self . children :
            res += curr . computeScore ( ) ;
        if ( self . parent == None ) :
            return res ;
        else :
            return 2 * res ;
def computeTree ( s ) :
    current = TreeNode ( ) ;
    root = current ;
    for i in range ( len ( s ) ) :
        if ( s [ i ] == ' ( ' ) :
            child = TreeNode ( ) ;
            child . setParent ( current ) ;
            current . addChild ( child ) ;
            current = child ;
        else :
            current = current . getParent ( ) ;
    return root ;
if __name__ == ' _ _ main _ _ ' :
    s = " ( ( ) ( ( ) ) ) " ;
    root = computeTree ( s ) ;
    print ( root . computeScore ( ) )

Index/key variables: i
Accumulator variables: res
Iterator variables: curr, i
Class/struct names: TreeNode
Python program:
def largestCharacter ( str ) :
    uppercase = [ False ] * 26
    lowercase = [ False ] * 26
    arr = list ( str )
    for c in arr :
        if ( c . islower ( ) ) :
            lowercase [ ord ( c ) - ord ( ' a ' ) ] = True
        if ( c . isupper ( ) ) :
            uppercase [ ord ( c ) - ord ( ' A ' ) ] = True
    for i in range ( 25 , - 1 , - 1 ) :
        if ( uppercase [ i ] and lowercase [ i ] ) :
            return chr ( i + ord ( ' A ' ) ) + " "
    return " - 1"
str = " admeDCAB "
print ( largestCharacter ( str ) )

Index/key variables: i
Iterator variables: c, i
Python program:
def finalString ( st ) :
    x , y = 0 , 0
    n = len ( st )
    for i in range ( n ) :
        if ( st [ i ] == '1' ) :
            x += 1
        else :
            y += 1
    if ( x > y ) :
        left = 1
    else :
        left = 0
    length = n - 2 * min ( x , y ) ;
    for i in range ( length ) :
        print ( left , end = " " )
if __name__ == " _ _ main _ _ " :
    st = "010110100100000"
    finalString ( st )

Index/key variables: i
Accumulator variables: x, y
Iterator variables: i
Python program:
def printPalindrome ( left , mid , right ) :
    for x in left :
        print ( x , end = " " )
    print ( mid , end = " " )
    right = right [ : : - 1 ]
    for x in right :
        print ( x , end = " " )
    print ( ' ' , end = " " )
def findPalindrome ( S , N , M ) :
    d = set ( )
    for i in range ( M ) :
        d . add ( S [ i ] )
    left = [ ]
    right = [ ]
    mid = " "
    for i in range ( N ) :
        t = S [ i ]
        t = t [ : : - 1 ]
        if ( t == S [ i ] ) :
            mid = t
        elif ( t in d ) :
            left . append ( S [ i ] )
            right . append ( t )
            d . remove ( S [ i ] )
            d . remove ( t )
    printPalindrome ( left , mid , right )
if __name__ == ' _ _ main _ _ ' :
    S = [ " tab " , " one " , " bat " ]
    M = 3
    N = len ( S )
    findPalindrome ( S , N , M )

Index/key variables: i
Accumulator variables: d, left, right
Iterator variables: i, x
Python program:
def IsLexicographicallySmaller ( A , B ) :
    if ( A < B ) :
        return True
    temp = A
    temp = ' ' . join ( sorted ( temp ) )
    index = - 1
    for i in range ( len ( A ) ) :
        if ( A [ i ] != temp [ i ] ) :
            index = i
            break
    if ( index == - 1 ) :
        return False
    j = 0
    for i in range ( len ( A ) ) :
        if ( A [ i ] == temp [ index ] ) :
            j = i
    A = list ( A )
    A [ index ] , A [ j ] = A [ j ] , A [ index ]
    A = ' ' . join ( A )
    if ( A < B ) :
        return True
    else :
        return False
A = " AGAIN "
B = " ACTION "
if ( IsLexicographicallySmaller ( A , B ) ) :
    print ( " Yes " )
else :
    print ( " No " )

Index/key variables: i, index, j
Iterator variables: i
Python program:
def maxi ( x , y ) :
    if x > y :
        return x
    else :
        return y
def longestPalindromic ( strn , i , j , count ) :
    if i > j :
        return count
    if i == j :
        return ( count + 1 )
    if strn [ i ] == strn [ j ] :
        count = longestPalindromic ( strn , i + 1 , j - 1 , count + 2 )
        return maxi ( count , maxi ( longestPalindromic ( strn , i + 1 , j , 0 ) , longestPalindromic ( strn , i , j - 1 , 0 ) ) )
    return maxi ( longestPalindromic ( strn , i + 1 , j , 0 ) , longestPalindromic ( strn , i , j - 1 , 0 ) )
def longest_palindromic_substr ( strn ) :
    k = len ( strn ) - 1
    return longestPalindromic ( strn , 0 , k , 0 )
strn = " aaaabbaa "
print ( longest_palindromic_substr ( strn ) )

Index/key variables: i, j
Python program:
def MaxPrefix ( string ) :
    Dict = { }
    maxprefix = 0
    for i in string :
        Dict [ i ] = Dict . get ( i , 0 ) + 1
    minfrequency = min ( Dict . values ( ) )
    countminFrequency = 0
    for x in Dict :
        if ( Dict [ x ] == minfrequency ) :
            countminFrequency += 1
    mapper = { }
    indi = 0
    for i in string :
        mapper [ i ] = mapper . get ( i , 0 ) + 1
        if ( mapper [ i ] > countminFrequency ) :
            break
        indi += 1
    print ( string [ : indi ] )
if __name__ == ' _ _ main _ _ ' :
    str = ' aabcdaab '
    MaxPrefix ( str )

Index/key variables: i, x
Accumulator variables: countminFrequency, indi
Iterator variables: i, x
Python program:
def countSubstring ( S , L , n ) :
    freq = [ 0 for i in range ( 26 ) ]
    for i in range ( n ) :
        freq [ ( ord ( L [ i ] ) - ord ( ' a ' ) ) ] = 1
    count , ans = 0 , 0
    for x in S :
        if ( freq [ ord ( x ) - ord ( ' a ' ) ] ) :
            ans += ( count * count + count ) // 2
            count = 0
        else :
            count += 1
    ans += ( count * count + count ) // 2
    return ans
S = " abcpxyz "
L = [ ' a ' , ' p ' , ' q ' ]
n = len ( L )
print ( countSubstring ( S , L , n ) )

Index/key variables: i
Accumulator variables: ans, count
Iterator variables: i, x
Python program:
def findNthOccur ( string , ch , N ) :
    occur = 0 ;
    for i in range ( len ( string ) ) :
        if ( string [ i ] == ch ) :
            occur += 1 ;
        if ( occur == N ) :
            return i ;
    return - 1 ;
if __name__ == " _ _ main _ _ " :
    string = " geeks " ;
    ch = ' e ' ;
    N = 2 ;
    print ( findNthOccur ( string , ch , N ) ) ;

Index/key variables: i
Accumulator variables: occur
Iterator variables: i
Python program:
def solve ( X , Y , N , K ) :
    count = [ 0 ] * ( N + 1 ) ;
    sol = 0 ;
    count [ 0 ] = 0 ;
    for i in range ( 1 , N + 1 ) :
        count [ i ] = ( count [ i - 1 ] + abs ( ord ( X [ i - 1 ] ) - ord ( Y [ i - 1 ] ) ) ) ;
    j = 0 ;
    for i in range ( 1 , N + 1 ) :
        while ( ( count [ i ] - count [ j ] ) > K ) :
            j += 1 ;
        sol = max ( sol , i - j ) ;
    return sol ;
if __name__ == ' _ _ main _ _ ' :
    N = 4 ;
    X = " abcd " ;
    Y = " bcde " ;
    K = 3 ;
    print ( solve ( X , Y , N , K ) ) ;

Index/key variables: i, j
Iterator variables: i
Python program:
from math import floor
def jaro_distance ( s1 , s2 ) :
    if ( s1 == s2 ) :
        return 1.0 ;
    len1 = len ( s1 ) ;
    len2 = len ( s2 ) ;
    if ( len1 == 0 or len2 == 0 ) :
        return 0.0 ;
    max_dist = ( max ( len ( s1 ) , len ( s2 ) ) // 2 ) - 1 ;
    match = 0 ;
    hash_s1 = [ 0 ] * len ( s1 ) ;
    hash_s2 = [ 0 ] * len ( s2 ) ;
    for i in range ( len1 ) :
        for j in range ( max ( 0 , i - max_dist ) , min ( len2 , i + max_dist + 1 ) ) :
            if ( s1 [ i ] == s2 [ j ] and hash_s2 [ j ] == 0 ) :
                hash_s1 [ i ] = 1 ;
                hash_s2 [ j ] = 1 ;
                match += 1 ;
                break ;
    if ( match == 0 ) :
        return 0.0 ;
    t = 0 ;
    point = 0 ;
    for i in range ( len1 ) :
        if ( hash_s1 [ i ] ) :
            while ( hash_s2 [ point ] == 0 ) :
                point += 1 ;
            if ( s1 [ i ] != s2 [ point ] ) :
                point += 1 ;
                t += 1 ;
            else :
                point += 1 ;
        t /= 2 ;
    return ( ( match / len1 + match / len2 + ( match - t ) / match ) / 3.0 ) ;
def jaro_Winkler ( s1 , s2 ) :
    jaro_dist = jaro_distance ( s1 , s2 ) ;
    if ( jaro_dist > 0.7 ) :
        prefix = 0 ;
        for i in range ( min ( len ( s1 ) , len ( s2 ) ) ) :
            if ( s1 [ i ] == s2 [ i ] ) :
                prefix += 1 ;
            else :
                break ;
        prefix = min ( 4 , prefix ) ;
        jaro_dist += 0.1 * prefix * ( 1 - jaro_dist ) ;
    return jaro_dist ;
if __name__ == " _ _ main _ _ " :
    s1 = " TRATE " ; s2 = " TRACE " ;
    print ( " Jaro - Winkler ▁ Similarity ▁ = " , jaro_Winkler ( s1 , s2 ) ) ;

Index/key variables: i, j, point
Accumulator variables: match, prefix, t
Iterator variables: i, j
Python program:
def isWordPresent ( sentence , word ) :
    s = sentence . split ( " ▁ " )
    for i in s :
        if ( i == word ) :
            return True
    return False
s = " Geeks ▁ for ▁ Geeks "
word = " Geeks "
if ( isWordPresent ( s , word ) ) :
    print ( " Yes " )
else :
    print ( " No " )

Iterator variables: i
Python program:
def isWordPresent ( sentence , word ) :
    word = word . upper ( )
    sentence = sentence . upper ( )
    s = sentence . split ( ) ;
    for temp in s :
        if ( temp == word ) :
            return True ;
    return False ;
if __name__ == " _ _ main _ _ " :
    s = " Geeks ▁ for ▁ Geeks " ;
    word = " geeks " ;
    if ( isWordPresent ( s , word ) ) :
        print ( " Yes " ) ;
    else :
        print ( " No " ) ;

Iterator variables: temp
Python program:
def countChars ( string , n ) :
    i = 0 ; cnt = 0 ;
    while ( i < n ) :
        if ( string [ i ] == '0' ) :
            i += 1 ;
        else :
            i += 2 ;
        cnt += 1 ;
    return cnt ;
if __name__ == " _ _ main _ _ " :
    string = "11010" ;
    n = len ( string ) ;
    print ( countChars ( string , n ) ) ;

Index/key variables: i
Accumulator variables: cnt
Python program:
MAX = 26 ;
def compressString ( s , n ) :
    freq = [ 0 ] * MAX ;
    for i in range ( n ) :
        freq [ ord ( s [ i ] ) - ord ( ' a ' ) ] += 1 ;
    for i in range ( MAX ) :
        if ( freq [ i ] == 0 ) :
            continue ;
        print ( ( chr ) ( i + ord ( ' a ' ) ) , freq [ i ] , end = " ▁ " ) ;
if __name__ == " _ _ main _ _ " :
    s = " geeksforgeeks " ;
    n = len ( s ) ;
    compressString ( s , n ) ;

Index/key variables: i
Iterator variables: i
Python program:
import math
def decBinary ( arr , n ) :
    k = int ( math . log2 ( n ) )
    while ( n > 0 ) :
        arr [ k ] = n % 2
        k = k - 1
        n = n // 2
def binaryDec ( arr , n ) :
    ans = 0
    for i in range ( 0 , n ) :
        ans = ans + ( arr [ i ] << ( n - i - 1 ) )
    return ans
def concat ( m , n ) :
    k = int ( math . log2 ( m ) ) + 1
    l = int ( math . log2 ( n ) ) + 1
    a = [ 0 for i in range ( 0 , k ) ]
    b = [ 0 for i in range ( 0 , l ) ]
    c = [ 0 for i in range ( 0 , k + l ) ]
    decBinary ( a , m ) ;
    decBinary ( b , n ) ;
    iin = 0
    for i in range ( 0 , k ) :
        c [ iin ] = a [ i ]
        iin = iin + 1
    for i in range ( 0 , l ) :
        c [ iin ] = b [ i ]
        iin = iin + 1
    return ( binaryDec ( c , k + l ) )
m = 4
n = 5
print ( concat ( m , n ) )

Index/key variables: i, iin, k
Iterator variables: i
Python program:
def getBinaryLength ( n ) :
    length = 0
    while ( n > 0 ) :
        length += 1
        n //= 2
    return length
def concat ( m , n ) :
    length = getBinaryLength ( n )
    return ( m << length ) + n
m , n = 4 , 5
print ( concat ( m , n ) )

Accumulator variables: length, n