dhyuti-n/xlcost-variable-roles huggingface dataset:
Python program:
def prefix ( k , n ) :
    a = 0
    b = 0
    count = 0
    i = 0
    Len = len ( k )
    for i in range ( Len ) :
        if ( k [ i ] == " a " ) :
            a += 1
        if ( k [ i ] == " b " ) :
            b += 1
        if ( a > b ) :
            count += 1
    if ( count == 0 or n == 1 ) :
        print ( count )
        return 0
    if ( count == Len or a - b == 0 ) :
        print ( count * n )
        return 0
    n2 = n - 1
    count2 = 0
    while ( n2 != 0 ) :
        for i in range ( Len ) :
            if ( k [ i ] == " a " ) :
                a += 1
            if ( k [ i ] == " b " ) :
                b += 1
            if ( a > b ) :
                count2 += 1
        count += count2
        n2 -= 1
        if ( count2 == 0 ) :
            break
        if ( count2 == Len ) :
            count += ( n2 * count2 )
            break
        count2 = 0
    return count
S = " aba "
N = 2
print ( prefix ( S , N ) )
S = " baa "
N = 3
print ( prefix ( S , N ) )

Index/key variables: i
Accumulator variables: a, b, count, count2, n2
Iterator variables: i
Python program:
mod = 1000000007
Max = 1001
nCr = [ [ 0 for _ in range ( 1003 ) ] for i in range ( 1003 ) ]
def preComputeCoeff ( ) :
    for i in range ( Max ) :
        for j in range ( i + 1 ) :
            if ( j == 0 or j == i ) :
                nCr [ i ] [ j ] = 1
            else :
                nCr [ i ] [ j ] = ( nCr [ i - 1 ] [ j - 1 ] + nCr [ i - 1 ] [ j ] ) % mod
def computeStringCount ( N ) :
    n = N // 2
    ans = 0
    for i in range ( 2 , n + 1 , 2 ) :
        ans = ( ans + ( ( nCr [ n ] [ i ] * nCr [ n ] [ i // 2 ] ) % mod ) ) % mod
    return ans
preComputeCoeff ( )
N = 3
print ( computeStringCount ( N ) )

Index/key variables: i, j, n
Iterator variables: i, j
Python program:
MAX = 100
def countSubsequence ( s , n ) :
    cntG = 0
    cntF = 0
    result = 0
    C = 0
    for i in range ( n ) :
        if ( s [ i ] == ' G ' ) :
            cntG += 1
            result += C
            continue
        if ( s [ i ] == ' F ' ) :
            cntF += 1
            C += cntG
            continue
        else :
            continue
    print ( result )
if __name__ == ' _ _ main _ _ ' :
    s = " GFGFG "
    n = len ( s )
    countSubsequence ( s , n )

Index/key variables: i
Accumulator variables: C, cntF, cntG, result
Iterator variables: i
Python program:
def LexicographicalMaxString ( str ) :
    mx = " "
    for i in range ( len ( str ) ) :
        mx = max ( mx , str [ i : ] )
    return mx
if __name__ == ' _ _ main _ _ ' :
    str = " ababaa "
    print ( LexicographicalMaxString ( str ) )

Iterator variables: i
Python program:
def LexicographicalMaxString ( st ) :
    maxchar = ' a '
    index = [ ]
    for i in range ( len ( st ) ) :
        if ( st [ i ] >= maxchar ) :
            maxchar = st [ i ]
            index . append ( i )
    maxstring = " "
    for i in range ( len ( index ) ) :
        if ( st [ index [ i ] : len ( st ) ] > maxstring ) :
            maxstring = st [ index [ i ] : len ( st ) ]
    return maxstring
if __name__ == " _ _ main _ _ " :
    st = " acbacbc "
    print ( LexicographicalMaxString ( st ) )

Index/key variables: i
Accumulator variables: index
Iterator variables: i
Python program:
def checkPalin ( word ) :
    n = len ( word )
    word = word . lower ( )
    for i in range ( n ) :
        if ( word [ i ] != word [ n - 1 ] ) :
            return False
        n -= 1
    return True
def longestPalin ( str ) :
    str = str + " ▁ "
    longestword = " "
    word = " "
    length1 = 0
    for i in range ( len ( str ) ) :
        ch = str [ i ]
        if ( ch != ' ▁ ' ) :
            word = word + ch
        else :
            length = len ( word )
            if ( checkPalin ( word ) and length > length1 ) :
                length1 = length
                longestword = word
            word = " "
    return longestword
if __name__ == " _ _ main _ _ " :
    s = " My ▁ name ▁ is ▁ ava ▁ and ▁ i ▁ love ▁ Geeksforgeeks "
    if ( longestPalin ( s ) == " " ) :
        print ( " No ▁ Palindrome ▁ Word " )
    else :
        print ( longestPalin ( s ) )

Index/key variables: i
Accumulator variables: n
Iterator variables: i
Python program:
def findstring ( s ) :
    n = len ( s )
    s = list ( s )
    i = 1
    while i < n - 1 :
        if ( s [ i - 1 ] == '0' and s [ i + 1 ] == '0' ) :
            s . pop ( i )
            i -= 1
            if i > 0 and s [ i - 1 ] == '0' :
                i -= 1
            n = len ( s )
        i += 1
    return ' ' . join ( s )
if __name__ == ' _ _ main _ _ ' :
    print ( findstring ( '100100' ) )

Accumulator variables: i
Python program:
import math ;
def isPerfectSquareString ( str ) :
    sum = 0 ;
    l = len ( str ) ;
    for i in range ( l ) :
        sum = sum + ord ( str [ i ] ) ;
    squareRoot = math . sqrt ( sum ) ;
    return ( ( squareRoot - math . floor ( squareRoot ) ) == 0 ) ;
str = " d " ;
if ( isPerfectSquareString ( str ) ) :
    print ( " Yes " ) ;
else :
    print ( " No " ) ;

Index/key variables: i
Iterator variables: i
Python program:
def index ( st , ch ) :
    for i in range ( len ( st ) ) :
        if ( st [ i ] == ch ) :
            return i ;
    return - 1
def printNumbers ( n , d ) :
    st = " " + str ( d )
    ch = st [ 0 ]
    for i in range ( 0 , n + 1 , 1 ) :
        st = " "
        st = st + str ( i )
        if ( i == d or index ( st , ch ) >= 0 ) :
            print ( i , end = " ▁ " )
if __name__ == ' _ _ main _ _ ' :
    n = 100
    d = 5
    printNumbers ( n , d )

Index/key variables: i
Iterator variables: i
Python program:
def isPanDigital ( s ) :
    digits = [ False ] * 10 ;
    for i in range ( 0 , len ( s ) ) :
        digits [ int ( s [ i ] ) - int ( '0' ) ] = True
    for i in range ( 0 , 10 ) :
        if ( digits [ i ] == False ) :
            return False
    return True
def countPandigitalPairs ( v ) :
    pairs = 0
    for i in range ( 0 , len ( v ) ) :
        for j in range ( i + 1 , len ( v ) ) :
            if ( isPanDigital ( v [ i ] + v [ j ] ) ) :
                pairs = pairs + 1
    return pairs
v = [ "123567" , "098234" , "14765" , "19804" ]
print ( countPandigitalPairs ( v ) )

Index/key variables: i, j
Iterator variables: i, j
Python program:
MAX_CHAR = [ 26 ]
def minChanges ( str ) :
    n = len ( str )
    if ( n > MAX_CHAR [ 0 ] ) :
        return - 1
    dist_count = 0
    count = [ 0 ] * MAX_CHAR [ 0 ]
    for i in range ( n ) :
        if ( count [ ord ( str [ i ] ) - ord ( ' a ' ) ] == 0 ) :
            dist_count += 1
        count [ ( ord ( str [ i ] ) - ord ( ' a ' ) ) ] += 1
    return ( n - dist_count )
if __name__ == ' _ _ main _ _ ' :
    str = " aebaecedabbee "
    print ( minChanges ( str ) )

Index/key variables: i
Accumulator variables: dist_count
Iterator variables: i
Python program:
class Node :
    def __init__ ( self , next = None , data = None ) :
        self . next = next
        self . data = data
def newNode ( c ) :
    temp = Node ( )
    temp . c = c
    temp . next = None
    return temp
def reverse_word ( str ) :
    s = " "
    i = 0
    while ( i < len ( str ) ) :
        s = str [ i ] + s
        i = i + 1
    return s
def reverse ( head ) :
    ptr = head
    while ( ptr != None ) :
        ptr . c = reverse_word ( ptr . c )
        ptr = ptr . next
    return head
def printList ( head ) :
    while ( head != None ) :
        print ( head . c , end = " ▁ " )
        head = head . next
head = newNode ( " Geeksforgeeks " )
head . next = newNode ( " a " )
head . next . next = newNode ( " computer " )
head . next . next . next = newNode ( " science " )
head . next . next . next . next = newNode ( " portal " )
head . next . next . next . next . next = newNode ( " for " )
head . next . next . next . next . next . next = newNode ( " geeks " )
print ( " List ▁ before ▁ reverse : ▁ " )
printList ( head )
head = reverse ( head )
print (   " List after reverse :   " )
printList ( head )

Index/key variables: i
Class/struct names: Node
Python program:
def CountSpecialPalindrome ( str ) :
    n = len ( str ) ;
    result = 0 ;
    sameChar = [ 0 ] * n ;
    i = 0 ;
    while ( i < n ) :
        sameCharCount = 1 ;
        j = i + 1 ;
        while ( j < n ) :
            if ( str [ i ] != str [ j ] ) :
                break ;
            sameCharCount += 1 ;
            j += 1 ;
        result += int ( sameCharCount * ( sameCharCount + 1 ) / 2 ) ;
        sameChar [ i ] = sameCharCount ;
        i = j ;
    for j in range ( 1 , n ) :
        if ( str [ j ] == str [ j - 1 ] ) :
            sameChar [ j ] = sameChar [ j - 1 ] ;
        if ( j > 0 and j < ( n - 1 ) and ( str [ j - 1 ] == str [ j + 1 ] and str [ j ] != str [ j - 1 ] ) ) :
            result += ( sameChar [ j - 1 ] if ( sameChar [ j - 1 ] < sameChar [ j + 1 ] ) else sameChar [ j + 1 ] ) ;
    return result - n ;
str = " abccba " ;
print ( CountSpecialPalindrome ( str ) ) ;

Index/key variables: i, j
Accumulator variables: result, sameCharCount
Iterator variables: j
Python program:
def binary_conversion ( s , m ) :
    while ( m ) :
        temp = m % 2
        s += str ( temp )
        m = m // 2
    return s [ : : - 1 ]
def find_character ( n , m , i ) :
    s = " "
    s = binary_conversion ( s , m )
    s1 = " "
    for x in range ( n ) :
        for j in range ( len ( s ) ) :
            if s [ j ] == "1" :
                s1 += "10"
            else :
                s1 += "01"
        s = s1
        s1 = " "
    e = ord ( s [ i ] )
    r = ord ( '0' )
    return e - r
m , n , i = 5 , 2 , 8
print ( find_character ( n , m , i ) )

Index/key variables: i, j
Accumulator variables: s, s1
Iterator variables: j, x
Python program:
def findMaxSegment ( s , k ) :
    seg_len = len ( s ) - k
    res = 0
    for i in range ( seg_len ) :
        res = res * 10 + ( ord ( s [ i ] ) - ord ( '0' ) )
    seg_len_pow = pow ( 10 , seg_len - 1 )
    curr_val = res
    for i in range ( 1 , len ( s ) - seg_len ) :
        curr_val = curr_val - ( ord ( s [ i - 1 ] ) - ord ( '0' ) ) * seg_len_pow
        curr_val = ( curr_val * 10 + ( ord ( s [ i + seg_len - 1 ] ) - ord ( '0' ) ) )
        res = max ( res , curr_val )
    return res
if __name__ == ' _ _ main _ _ ' :
    s = "8754"
    k = 2
    print ( " Maximum ▁ number ▁ = ▁ " , findMaxSegment ( s , k ) )

Index/key variables: i
Iterator variables: i
Python program:
def isConvertible ( str1 , str2 , k ) :
    if ( ( len ( str1 ) + len ( str2 ) ) < k ) :
        return True
    commonLength = 0
    for i in range ( 0 , min ( len ( str1 ) , len ( str2 ) ) , 1 ) :
        if ( str1 [ i ] == str2 [ i ] ) :
            commonLength += 1
        else :
            break
    if ( ( k - len ( str1 ) - len ( str2 ) + 2 * commonLength ) % 2 == 0 ) :
        return True
    return False
if __name__ == ' _ _ main _ _ ' :
    str1 = " geek "
    str2 = " geek "
    k = 7
    if ( isConvertible ( str1 , str2 , k ) ) :
        print ( " Yes " )
    else :
        print ( " No " )
    str1 = " geeks "
    str2 = " geek "
    k = 5
    if ( isConvertible ( str1 , str2 , k ) ) :
        print ( " Yes " )
    else :
        print ( " No " )

Index/key variables: i
Accumulator variables: commonLength
Iterator variables: i
Python program:
MAX_CHAR = 26
def maxLower ( str ) :
    n = len ( str )
    i = 0
    for i in range ( n ) :
        if str [ i ] >= ' A ' and str [ i ] <= ' Z ' :
            i += 1
            break
    maxCount = 0
    count = [ ]
    for j in range ( MAX_CHAR ) :
        count . append ( 0 )
    for j in range ( i , n ) :
        if str [ j ] >= ' A ' and str [ j ] <= ' Z ' :
            currCount = 0
            for k in range ( MAX_CHAR ) :
                if count [ k ] > 0 :
                    currCount += 1
            maxCount = max ( maxCount , currCount )
            for y in count :
                y = 0
        if str [ j ] >= ' a ' and str [ j ] <= ' z ' :
            count [ ord ( str [ j ] ) - ord ( ' a ' ) ] += 1
    return maxCount
str = " zACaAbbaazzC " ;
print ( maxLower ( str ) )

Index/key variables: i, j, k
Accumulator variables: count, currCount
Iterator variables: i, j, k, y
Python program:
def maxLower ( str ) :
    n = len ( str ) ;
    i = 0 ;
    for i in range ( n ) :
        if ( str [ i ] >= ' A ' and str [ i ] <= ' Z ' ) :
            i += 1 ;
            break ;
    maxCount = 3 ;
    s = set ( )
    for i in range ( n ) :
        if ( str [ i ] >= ' A ' and str [ i ] <= ' Z ' ) :
            maxCount = max ( maxCount , len ( s ) ) ;
            s . clear ( ) ;
        if ( str [ i ] >= ' a ' and str [ i ] <= ' z ' ) :
            s . add ( str [ i ] ) ;
            return maxCount ;
if __name__ == ' _ _ main _ _ ' :
    str = " zACaAbbaazzC " ;
    print ( maxLower ( str ) ) ;

Index/key variables: i
Accumulator variables: s
Iterator variables: i
Python program:
def first ( str ) :
    for i in range ( 0 , len ( str ) ) :
        if ( str [ i ] . istitle ( ) ) :
            return str [ i ]
    return 0
str = " geeksforGeeKS "
res = first ( str )
if ( res == 0 ) :
    print ( " No ▁ uppercase ▁ letter " )
else :
    print ( res )

Index/key variables: i
Iterator variables: i
Python program:
import math as mt
def fact ( n ) :
    ans = 1
    for i in range ( 1 , n + 1 ) :
        ans = ans * i
    return ( ans )
def numberOfPossiblePallindrome ( string , n ) :
    mp = dict ( )
    for i in range ( n ) :
        if string [ i ] in mp . keys ( ) :
            mp [ string [ i ] ] += 1
        else :
            mp [ string [ i ] ] = 1
    fi = 0
    for it in mp :
        if ( mp [ it ] % 2 == 0 ) :
            fi = mp [ it ] // 2
        else :
            fi = ( mp [ it ] - 1 ) // 2
            k += 1
        num = num + fi
        den = den * fact ( fi )
    if ( num != 0 ) :
        num = fact ( num )
    ans = num // den
    if ( k != 0 ) :
        ans = ans * k
    return ( ans )
string = " ababab "
n = len ( string )
print ( numberOfPossiblePallindrome ( string , n ) )

Index/key variables: i, it
Accumulator variables: k
Iterator variables: i, it
Python program:
import math
def evenDecimalValue ( str , n ) :
    result = 0
    for i in range ( 0 , n ) :
        for j in range ( i , n ) :
            decimalValue = 0 ;
            powerOf2 = 1 ;
            for k in range ( i , j + 1 ) :
                decimalValue += ( ( int ( str [ k ] ) - 0 ) * powerOf2 )
                powerOf2 *= 2
            if ( decimalValue % 2 == 0 ) :
                result += 1
    return result
str = "10010"
n = 5
print ( evenDecimalValue ( str , n ) )

Index/key variables: k
Accumulator variables: decimalValue, powerOf2, result
Iterator variables: i, j, k
Python program:
def palindrome ( s : str , n : int ) -> int :
    cnt = dict ( )
    R = [ ]
    for i in range ( n ) :
        a = s [ i ]
        if a in cnt :
            cnt [ a ] += 1
        else :
            cnt [ a ] = 1
    i = ' a '
    while i <= ' z ' :
        if i in cnt and cnt [ i ] % 2 != 0 :
            R += i
        i = chr ( ord ( i ) + 1 )
    l = len ( R )
    j = 0
    for i in range ( l - 1 , ( l // 2 ) - 1 , - 1 ) :
        if R [ i ] in cnt :
            cnt [ R [ i ] ] -= 1
        else :
            cnt [ R [ i ] ] = - 1
        R [ i ] = R [ j ]
        if R [ j ] in cnt :
            cnt [ R [ j ] ] += 1
        else :
            cnt [ R [ j ] ] = 1
        j += 1
    first , middle , second = " " , " " , " "
    i = ' a '
    while i <= ' z ' :
        if i in cnt :
            if cnt [ i ] % 2 == 0 :
                j = 0
                while j < cnt [ i ] // 2 :
                    first += i
                    j += 1
            else :
                j = 0
                while j < ( cnt [ i ] - 1 ) // 2 :
                    first += i
                    j += 1
                middle += i
        i = chr ( ord ( i ) + 1 )
    second = first
    second = ' ' . join ( reversed ( second ) )
    resultant = first + middle + second
    print ( resultant )
if __name__ == " _ _ main _ _ " :
    S = " geeksforgeeks "
    n = len ( S )
    palindrome ( S , n )

Index/key variables: a, i, j
Accumulator variables: R, first, middle
Iterator variables: i
Python program:
def isConsonant ( ch ) :
    ch = ch . upper ( )
    return not ( ch == ' A ' or ch == ' E ' or ch == ' I ' or ch == ' O ' or ch == ' U ' ) and ord ( ch ) >= 65 and ord ( ch ) <= 90
def totalConsonants ( string ) :
    count = 0
    for i in range ( len ( string ) ) :
        if ( isConsonant ( string [ i ] ) ) :
            count += 1
    return count
string = " abc ▁ de "
print ( totalConsonants ( string ) )

Index/key variables: i
Accumulator variables: count
Iterator variables: i
Python program:
MAX = 26
def Swap ( s , t , n ) :
    dp = [ [ - 1 for x in range ( MAX ) ] for y in range ( MAX ) ]
    tot = 0 ;
    for i in range ( n ) :
        if ( s [ i ] != t [ i ] ) :
            tot += 1
    for i in range ( n ) :
        a = ord ( s [ i ] ) - ord ( ' a ' )
        b = ord ( t [ i ] ) - ord ( ' a ' )
        if ( a == b ) :
            continue
        if ( dp [ a ] [ b ] != - 1 ) :
            print ( i + 1 , " ▁ " , dp [ a ] [ b ] + 1 )
            return
        dp [ b ] [ a ] = i
    A = [ - 1 ] * MAX
    B = [ - 1 ] * MAX
    for i in range ( n ) :
        a = ord ( s [ i ] ) - ord ( ' a ' )
        b = ord ( t [ i ] ) - ord ( ' a ' )
        if ( a == b ) :
            continue
        if ( A [ b ] != - 1 ) :
            print ( i + 1 , A [ b ] + 1 )
            return
        if ( B [ a ] != - 1 ) :
            print ( i + 1 , B [ a ] + 1 )
            return
        A [ a ] = i
        B [ b ] = i
    print ( " - 1" )
if __name__ == " _ _ main _ _ " :
    S = " permanent "
    T = " pergament "
    n = len ( S )
    if ( S == " " or T == " " ) :
        print ( " Required ▁ string ▁ is ▁ empty . " )
    else :
        Swap ( S , T , n )

Index/key variables: a, b, i
Accumulator variables: tot
Iterator variables: i
Python program:
MAX = 26
def printAnagramAndChanges ( x , y ) :
    x = list ( x )
    y = list ( y )
    countx , county = [ 0 ] * MAX , [ 0 ] * MAX
    ctrx , ctry = [ 0 ] * MAX , [ 0 ] * MAX
    change = 0
    l = len ( x )
    for i in range ( l ) :
        countx [ ord ( x [ i ] ) - ord ( ' A ' ) ] += 1
        county [ ord ( y [ i ] ) - ord ( ' A ' ) ] += 1
    for i in range ( MAX ) :
        if countx [ i ] > county [ i ] :
            ctrx [ i ] += ( countx [ i ] - county [ i ] )
        elif countx [ i ] < county [ i ] :
            ctry [ i ] += ( county [ i ] - countx [ i ] )
        change += abs ( county [ i ] - countx [ i ] )
    for i in range ( l ) :
        if ctrx [ ord ( x [ i ] ) - ord ( ' A ' ) ] == 0 :
            continue
        j = 0
        for j in range ( MAX ) :
            if ctry [ j ] > 0 :
                break
        if countx [ ord ( x [ i ] ) - ord ( ' A ' ) ] == ctrx [ ord ( x [ i ] ) - ord ( ' A ' ) ] or ord ( x [ i ] ) - ord ( ' A ' ) > j :
            countx [ ord ( x [ i ] ) - ord ( ' A ' ) ] -= 1
            ctrx [ ord ( x [ i ] ) - ord ( ' A ' ) ] -= 1
            ctry [ j ] -= 1
            x [ i ] = chr ( ord ( ' A ' ) + j )
        else :
            countx [ ord ( x [ i ] ) - ord ( ' A ' ) ] -= 1
    print ( " Anagram ▁ : " , ' ' . join ( x ) )
    print ( " Number ▁ of ▁ changes ▁ made ▁ : " , change // 2 )
if __name__ == " _ _ main _ _ " :
    x = " CDBABC "
    y = " ADCABD "
    printAnagramAndChanges ( x , y )

Index/key variables: i, j
Accumulator variables: change
Iterator variables: i, j
Python program:
MAX = 256
def countPairs ( s ) :
    cnt = [ 0 for i in range ( 0 , MAX ) ]
    for i in range ( len ( s ) ) :
        cnt [ ord ( s [ i ] ) - 97 ] += 1
    ans = 0
    for i in range ( 0 , MAX ) :
        ans += cnt [ i ] * cnt [ i ]
    return ans
if __name__ == " _ _ main _ _ " :
    s = " geeksforgeeks "
    print ( countPairs ( s ) )

Index/key variables: i
Accumulator variables: ans
Iterator variables: i
Python program:
def solve ( n , t , p ) :
    s = list ( p )
    for i in range ( 0 , t ) :
        for j in range ( 0 , n - 1 ) :
            if ( s [ j ] == ' B ' and s [ j + 1 ] == ' G ' ) :
                temp = s [ j ] ;
                s [ j ] = s [ j + 1 ] ;
                s [ j + 1 ] = temp ;
                j = j + 1
    print ( ' ' . join ( s ) )
n = 6
t = 2
p = " BBGBBG "
solve ( n , t , p )

Index/key variables: j
Iterator variables: i, j
Python program:
def calSumUtil ( a , b , n , m ) :
    sum = [ 0 ] * n
    i = n - 1
    j = m - 1
    k = n - 1
    carry = 0
    s = 0
    while j >= 0 :
        s = a [ i ] + b [ j ] + carry
        sum [ k ] = ( s % 10 )
        carry = s // 10
        k -= 1
        i -= 1
        j -= 1
    while i >= 0 :
        s = a [ i ] + carry
        sum [ k ] = ( s % 10 )
        carry = s // 10
        i -= 1
        k -= 1
    ans = 0
    if carry :
        ans = 10
    for i in range ( n ) :
        ans += sum [ i ]
        ans *= 10
    return ans // 10
def calSum ( a , b , n , m ) :
    if n >= m :
        return calSumUtil ( a , b , n , m )
    else :
        return calSumUtil ( b , a , m , n )
a = [ 9 , 3 , 9 ]
b = [ 6 , 1 ]
n = len ( a )
m = len ( b )
print ( calSum ( a , b , n , m ) )

Index/key variables: i, j, k
Accumulator variables: ans
Iterator variables: i
Python program:
def isPanalphabeticWindow ( s , n ) :
    ch = ' a '
    for i in range ( 0 , n ) :
        if ( s [ i ] == ch ) :
            ch = chr ( ord ( ch ) + 1 )
        if ( ch == ' z ' ) :
            return True
    return False
s = " abujm ▁ zvcd ▁ acefc ▁ deghf ▁ gijkle ▁ m ▁ n ▁ o ▁ p ▁ pafqrstuvwxyzfap "
n = len ( s )
if ( isPanalphabeticWindow ( s , n ) ) :
    print ( " YES " )
else :
    print ( " NO " )

Index/key variables: i
Iterator variables: i
Python program:
def isPrime ( n ) :
    if n <= 1 :
        return False
    for i in range ( 2 , n ) :
        if n % i == 0 :
            return False ;
    return True
def prime_index ( input ) :
    p = list ( input )
    s = " "
    for i in range ( 2 , len ( p ) + 1 ) :
        if isPrime ( i ) :
            s = s + input [ i - 1 ]
    print ( s )
input = " GeeksforGeeks "
prime_index ( input )

Iterator variables: i
Python program:
def isHeterogram ( s , n ) :
    hash = [ 0 ] * 26
    for i in range ( n ) :
        if s [ i ] != ' ▁ ' :
            if hash [ ord ( s [ i ] ) - ord ( ' a ' ) ] == 0 :
                hash [ ord ( s [ i ] ) - ord ( ' a ' ) ] = 1
            else :
                return False
    return True
s = " the ▁ big ▁ dwarf ▁ only ▁ jumps "
n = len ( s )
print ( " YES " if isHeterogram ( s , n ) else " NO " )

Index/key variables: i
Iterator variables: i
Python program:
def convert ( string ) :
    n = len ( string ) ;
    string = list ( string ) ;
    for i in range ( n ) :
        if ( string [ i ] == ' ▁ ' ) :
            string [ i ] = ' _ ' ;
        else :
            string [ i ] = string [ i ] . lower ( ) ;
    string = " " . join ( string )
    print ( string ) ;
if __name__ == " _ _ main _ _ " :
    string = " I ▁ got ▁ intern ▁ at ▁ geeksforgeeks " ;
    convert ( string ) ;

Index/key variables: i
Iterator variables: i
Python program:
def largestAnagramSet ( arr , n ) :
    maxSize = 0
    count = { }
    for i in range ( n ) :
        arr [ i ] = ' ' . join ( sorted ( arr [ i ] ) )
        if arr [ i ] in count :
            count [ arr [ i ] ] += 1
        else :
            count [ arr [ i ] ] = 1
        maxSize = max ( maxSize , count [ arr [ i ] ] )
    return maxSize
arr = [ " ant " , " magenta " , " magnate " , " tan " , " gnamate " ]
n = len ( arr )
print ( largestAnagramSet ( arr , n ) )
arr1 = [ " cars " , " bikes " , " arcs " , " steer " ]
n = len ( arr1 )
print ( largestAnagramSet ( arr1 , n ) )

Index/key variables: i
Iterator variables: i