dhyuti-n/xlcost-variable-roles huggingface dataset:
Python program:
def smallest ( s ) :
    l = len ( s )
    ans = " "
    for i in range ( l - 1 ) :
        if ( s [ i ] > s [ i + 1 ] ) :
            for j in range ( l ) :
                if ( i != j ) :
                    ans += s [ j ]
            return ans
    ans = s [ 0 : l - 1 ]
    return ans
if __name__ == " _ _ main _ _ " :
    s = " abcda "
    print ( smallest ( s ) )

Index/key variables: i, j
Accumulator variables: ans
Iterator variables: i, j
Python program:
import math
def fact ( n ) :
    f = 1 ;
    for i in range ( 2 , n + 1 ) :
        f = f * i ;
    return f ;
def npr ( n , r ) :
    return fact ( n ) / fact ( n - r ) ;
def countPermutations ( str ) :
    even = math . floor ( len ( str ) / 2 ) ;
    odd = len ( str ) - even ;
    ways = 0 ;
    freq = [ 0 ] * 26 ;
    for i in range ( len ( str ) ) :
        freq [ ord ( str [ i ] ) - ord ( ' a ' ) ] += 1 ;
    nvowels = ( freq [ 0 ] + freq [ 4 ] + freq [ 8 ] + freq [ 14 ] + freq [ 20 ] ) ;
    nconsonants = len ( str ) - nvowels ;
    ways = ( npr ( odd , nvowels ) * npr ( nconsonants , nconsonants ) ) ;
    return int ( ways ) ;
str = " geeks " ;
print ( countPermutations ( str ) ) ;

Index/key variables: i
Iterator variables: i
Python program:
def replacingConsonants ( s ) :
    nVowel = " aaaeeeeiiiiioooooouuuuuuuu "
    for i in range ( 0 , len ( s ) ) :
        s = s . replace ( s [ i ] , nVowel [ ord ( s [ i ] ) - 97 ] )
    return s
s = " geeksforgeeks " ;
print ( replacingConsonants ( s ) ) ;

Index/key variables: i
Iterator variables: i
Python program:
def isVowel ( ch ) :
    if ( ch != ' a ' and ch != ' e ' and ch != ' i ' and ch != ' o ' and ch != ' u ' ) :
        return False ;
    return True ;
def replaceConsonants ( s ) :
    for i in range ( len ( s ) ) :
        if ( isVowel ( s [ i ] ) == False ) :
            if ( s [ i ] == ' z ' ) :
                s [ i ] = ' b ' ;
            else :
                s [ i ] = chr ( ord ( s [ i ] ) + 1 ) ;
                if ( isVowel ( s [ i ] ) == True ) :
                    s [ i ] = chr ( ord ( s [ i ] ) + 1 ) ;
    return ' ' . join ( s ) ;
s = " geeksforgeeks " ;
print ( replaceConsonants ( list ( s ) ) ) ;

Index/key variables: i
Iterator variables: i
Python program:
MAX_CHAR = 26
def removeChars ( str , k ) :
    hash = [ 0 ] * ( MAX_CHAR )
    n = len ( str )
    for i in range ( n ) :
        hash [ ord ( str [ i ] ) - ord ( ' a ' ) ] += 1
    res = " "
    for i in range ( n ) :
        if ( hash [ ord ( str [ i ] ) - ord ( ' a ' ) ] >= k ) :
            res += str [ i ]
    return res
if __name__ == " _ _ main _ _ " :
    str = " geeksforgeeks "
    k = 2
    print ( removeChars ( str , k ) )

Index/key variables: i
Accumulator variables: res
Iterator variables: i
Python program:
def countOnOff ( n ) :
    Led = [ 6 , 2 , 5 , 5 , 4 , 5 , 6 , 3 , 7 , 5 ]
    leng = len ( n )
    sum = Led [ int ( n [ 0 ] ) - int ( '0' ) ]
    for i in range ( 1 , leng ) :
        sum = ( sum + abs ( Led [ int ( n [ i ] ) - int ( '0' ) ] - Led [ int ( n [ i - 1 ] ) - int ( '0' ) ] ) )
    return sum
if __name__ == ' _ _ main _ _ ' :
    n = "082"
    print ( countOnOff ( n ) )

Index/key variables: i
Iterator variables: i
Python program:
def check ( s ) :
    freq = [ 0 ] * 26
    n = len ( s )
    for i in range ( n ) :
        freq [ ord ( s [ i ] ) - 97 ] += 1
    for i in range ( 26 ) :
        if ( freq [ i ] % 2 == 1 ) :
            return False
    return True
s = " abaccaba "
if ( check ( s ) ) :
    print ( " Yes " )
else :
    print ( " No " )

Index/key variables: i
Iterator variables: i
Python program:
def max_length_substring ( st , n , k ) :
    max_len = 0
    len = 0
    for i in range ( 0 , n ) :
        if ( st [ i ] == '0' ) :
            len = len + 1 ;
        else :
            len = 0
        max_len = max ( max_len , len )
    if ( max_len == n ) :
        return n * k
    pref = 0
    suff = 0
    i = 0
    while ( st [ i ] == '0' ) :
        i = i + 1
        pref = pref + 1
    i = n - 1
    while ( st [ i ] == '0' ) :
        i = i - 1
        suff = suff + 1
    if ( k > 1 ) :
        max_len = max ( max_len , pref + suff )
    return max_len
n = 6
k = 3
st = "110010"
ans = max_length_substring ( st , n , k )
print ( ans )

Index/key variables: i
Iterator variables: i
Python program:
def countSubStr ( S , X ) :
    cnt = 0
    N = len ( S )
    for i in range ( 0 , N ) :
        if ( S [ i ] != '0' ) :
            j = 1
            while ( ( j + i ) <= N ) :
                num = int ( S [ i : i + j ] )
                if ( num > X ) :
                    cnt = cnt + 1
                j = j + 1
    return cnt ;
S = "2222" ;
X = 97 ;
print ( countSubStr ( S , X ) )

Index/key variables: i
Iterator variables: i
Python program:
def fact ( n ) :
    result = 1
    for i in range ( 1 , n + 1 ) :
        result *= i
    return result
def getResult ( string , ch ) :
    has = [ 0 ] * 26
    for i in range ( len ( string ) ) :
        has [ ord ( string [ i ] ) - ord ( ' A ' ) ] += 1
    particular = has [ ord ( ch ) - ord ( ' A ' ) ]
    if particular == 0 :
        return 0
    has [ ord ( ch ) - ord ( ' A ' ) ] = 0
    total = len ( string )
    total = total - particular + 1
    result = fact ( total )
    for i in range ( 26 ) :
        if has [ i ] > 1 :
            result /= fact ( has [ i ] )
    return result
if __name__ == " _ _ main _ _ " :
    string = " MISSISSIPPI "
    print ( getResult ( string , ' S ' ) )

Index/key variables: i
Accumulator variables: result
Iterator variables: i
Python program:
def isAnyNotPalindrome ( s ) :
    unique = set ( )
    for i in range ( 0 , len ( s ) ) :
        unique . add ( s [ i ] )
    if ( len ( unique ) > 1 ) :
        return True
    else :
        return False
if __name__ == ' _ _ main _ _ ' :
    s = " aaaaab "
    if ( isAnyNotPalindrome ( s ) ) :
        print ( " YES " )
    else :
        print ( " NO " )

Index/key variables: i
Accumulator variables: unique
Iterator variables: i
Python program:
def factorial ( n ) :
    res = 1
    for i in range ( 1 , n + 1 ) :
        res = res * i
    return res
def count ( word ) :
    freq = [ 0 for i in range ( 30 ) ]
    vowel = 0
    consonant = 0
    for i in range ( len ( word ) ) :
        freq [ ord ( word [ i ] ) - 65 ] += 1
        if ( word [ i ] == ' A ' or word [ i ] == ' E ' or word [ i ] == ' I ' or word [ i ] == ' O ' or word [ i ] == ' U ' ) :
            vowel += 1
        else :
            consonant += 1
    vowelArrange = factorial ( vowel )
    vowelArrange //= factorial ( freq [ 0 ] )
    vowelArrange //= factorial ( freq [ 4 ] )
    vowelArrange //= factorial ( freq [ 8 ] )
    vowelArrange //= factorial ( freq [ 14 ] )
    vowelArrange //= factorial ( freq [ 20 ] )
    consonantArrange = factorial ( consonant )
    for i in range ( 26 ) :
        if ( i != 0 and i != 4 and i != 8 and i != 14 and i != 20 ) :
            consonantArrange //= factorial ( freq [ i ] )
    total = vowelArrange * consonantArrange
    return total
word = " COMPUTER "
ans = count ( word )
print ( ans )

Index/key variables: i
Accumulator variables: consonant, consonantArrange, vowel
Iterator variables: i
Python program:
def isPalindrome ( s ) :
    s1 = " "
    N = len ( s )
    i = ( N - 1 )
    while ( i >= 0 ) :
        s1 += s [ i ]
        i = i - 1
    if ( s == s1 ) :
        return True
    return False
def createString ( N ) :
    s2 = " "
    s = str ( N )
    letters = " abcdefghij "
    sum = 0
    substr = " "
    for i in range ( 0 , len ( s ) ) :
        digit = int ( s [ i ] )
        substr += letters [ digit ]
        sum += digit
    while ( len ( s2 ) <= sum ) :
        s2 += substr
    s2 = s2 [ : sum ]
    return isPalindrome ( s2 )
N = 61 ;
flag = createString ( N )
if ( flag ) :
    print ( " YES " )
else :
    print ( " NO " )

Index/key variables: digit, i
Accumulator variables: s1, s2, substr, sum
Iterator variables: i
Python program:
def productAscii ( str ) :
    prod = 1
    for i in range ( 0 , len ( str ) ) :
        prod = prod * ord ( str [ i ] )
    return prod
if __name__ == ' _ _ main _ _ ' :
    str = " GfG "
    print ( productAscii ( str ) )

Index/key variables: i
Iterator variables: i
Python program:
import sys
MAX = sys . maxsize
def minOperation ( s , i , j , count ) :
    if ( ( i >= len ( s ) and j < 0 ) or ( i == j ) ) :
        return MAX
    if ( s [ i ] == s [ j ] ) :
        return count
    if ( i >= len ( s ) ) :
        return minOperation ( s , i , j - 1 , count + 1 )
    elif ( j < 0 ) :
        return minOperation ( s , i + 1 , j , count + 1 )
    else :
        return min ( minOperation ( s , i , j - 1 , count + 1 ) , minOperation ( s , i + 1 , j , count + 1 ) )
if __name__ == ' _ _ main _ _ ' :
    s = " bacdefghipalop "
    ans = minOperation ( s , 0 , len ( s ) - 1 , 0 )
    if ( ans == MAX ) :
        print ( - 1 )
    else :
        print ( ans )

Index/key variables: i, j
Python program:
def countStrings ( s ) :
    sum = 1
    for i in range ( len ( s ) ) :
        if ( i % 2 == 0 and s [ i ] == ' $ ' ) :
            sum *= 21
        elif ( s [ i ] == ' $ ' ) :
            sum *= 5
    return sum
if __name__ == " _ _ main _ _ " :
    str = " s $ $ e $ "
    print ( countStrings ( str ) )

Index/key variables: i
Accumulator variables: sum
Iterator variables: i
Python program:
def removeDuplicatesFromString ( str2 ) :
    counter = 0 ;
    i = 0 ;
    size = len ( str2 ) ;
    str1 = list ( str2 ) ;
    x = 0 ;
    length = 0 ;
    while ( i < size ) :
        x = ord ( str1 [ i ] ) - 97 ;
        if ( ( counter & ( 1 << x ) ) == 0 ) :
            str1 [ length ] = chr ( 97 + x ) ;
            counter = counter | ( 1 << x ) ;
            length += 1 ;
        i += 1 ;
    str2 = ' ' . join ( str1 ) ;
    return str2 [ 0 : length ] ;
str1 = " geeksforgeeks " ;
print ( removeDuplicatesFromString ( str1 ) ) ;

Index/key variables: i, length
Python program:
def firstPos ( str , start , end ) :
    firstChar = - 1
    for i in range ( start , end + 1 ) :
        if ( str [ i ] >= ' a ' and str [ i ] <= ' z ' ) :
            firstChar = i
            break
    return firstChar
def lastPos ( str , start , end ) :
    lastChar = - 1
    for i in range ( start , end - 1 , - 1 ) :
        if ( str [ i ] >= ' a ' and str [ i ] <= ' z ' ) :
            lastChar = i
            break
    return lastChar
def isPalindrome ( str ) :
    firstChar = 0
    lastChar = len ( str ) - 1
    ch = True
    for i in range ( len ( str ) ) :
        firstChar = firstPos ( str , firstChar , lastChar ) ;
        lastChar = lastPos ( str , lastChar , firstChar ) ;
        if ( lastChar < 0 or firstChar < 0 ) :
            break
        if ( str [ firstChar ] == str [ lastChar ] ) :
            firstChar += 1
            lastChar -= 1
            continue
        ch = False
        break
    return ( ch )
if __name__ == " _ _ main _ _ " :
    str = " m TABSYMBOL a ▁ 343 ▁ la ▁ y ▁ a ▁ l ▁ am "
    if ( isPalindrome ( str ) ) :
        print ( " YES " )
    else :
        print ( " NO " )

Index/key variables: firstChar, i, lastChar
Iterator variables: i
Boolean variables: ch
Python program:
def find ( s ) :
    Max = j = countk = countr = 0
    table = [ [ 0 , 0 ] for i in range ( len ( s ) ) ]
    for i in range ( 0 , len ( s ) ) :
        if s [ i ] == ' R ' :
            countr += 1
        else :
            table [ j ] [ 0 ] = countr
            j += 1
    j -= 1
    for i in range ( len ( s ) - 1 , - 1 , - 1 ) :
        if s [ i ] == ' K ' :
            countk += 1
            table [ j ] [ 1 ] = countk
            j -= 1
        if min ( table [ j + 1 ] [ 0 ] , table [ j + 1 ] [ 1 ] ) > Max :
            Max = min ( table [ j + 1 ] [ 0 ] , table [ j + 1 ] [ 1 ] )
    return Max
if __name__ == " _ _ main _ _ " :
    s = " RKRRRKKRRKKKKRR "
    print ( find ( s ) )

Index/key variables: i, j
Accumulator variables: countk, countr
Iterator variables: i
Python program:
def frequency ( fre , s , n ) :
    for i in range ( 0 , n ) :
        string = s [ i ]
        for j in range ( 0 , len ( string ) ) :
            fre [ i ] [ ord ( string [ j ] ) - ord ( ' a ' ) ] += 1
def LongestSequence ( fre , n ) :
    for i in range ( MAX_CHAR - 1 , - 1 , - 1 ) :
        mi = fre [ 0 ] [ i ]
        for j in range ( 1 , n ) :
            mi = min ( fre [ j ] [ i ] , mi )
        while mi :
            print ( chr ( ord ( ' a ' ) + i ) , end = " " )
            mi -= 1
if __name__ == " _ _ main _ _ " :
    s = [ " loo " , " lol " , " olive " ]
    n = len ( s )
    MAX_CHAR = 26
    fre = [ [ 0 for i in range ( 26 ) ] for j in range ( n ) ]
    frequency ( fre , s , n )
    LongestSequence ( fre , n )

Index/key variables: i, j
Accumulator variables: mi
Iterator variables: i, j
Python program:
def arePermutation ( str1 , str2 ) :
    n1 = len ( str1 )
    n2 = len ( str2 )
    if ( n1 != n2 ) :
        return False
    a = sorted ( str1 )
    str1 = " ▁ " . join ( a )
    b = sorted ( str2 )
    str2 = " ▁ " . join ( b )
    for i in range ( 0 , n1 , 1 ) :
        if ( str1 [ i ] != str2 [ i ] ) :
            return False
    return True
if __name__ == ' _ _ main _ _ ' :
    str1 = " test "
    str2 = " ttew "
    if ( arePermutation ( str1 , str2 ) ) :
        print ( " Yes " )
    else :
        print ( " No " )

Index/key variables: i
Iterator variables: i
Python program:
def powerOfJump ( s ) :
    count = 1
    max_so_far = 0
    ch = s [ - 1 ]
    for i in range ( 0 , len ( s ) ) :
        if s [ i ] == ch :
            if count > max_so_far :
                max_so_far = count
            count = 1
        else :
            count += 1
    return max_so_far
if __name__ == " _ _ main _ _ " :
    st = "1010101"
    print ( powerOfJump ( st ) )

Index/key variables: i
Accumulator variables: count
Iterator variables: i
Python program:
def findLongestSub ( bin1 ) :
    n = len ( bin1 )
    sum = 0
    prevSum = { i : 0 for i in range ( n ) }
    maxlen = 0
    for i in range ( n ) :
        if ( bin1 [ i ] == '1' ) :
            sum += 1
        else :
            sum -= 1
        if ( sum > 0 ) :
            maxlen = i + 1
        elif ( sum <= 0 ) :
            if ( ( sum - 1 ) in prevSum ) :
                currlen = i - prevSum [ sum - 1 ]
                maxlen = max ( maxlen , currlen )
        if ( ( sum ) not in prevSum ) :
            prevSum [ sum ] = i
    return maxlen
if __name__ == ' _ _ main _ _ ' :
    bin1 = "1010"
    print ( findLongestSub ( bin1 ) )

Index/key variables: i, sum
Iterator variables: i
Python program:
def averageValue ( s ) :
    sum_char = 0
    for i in range ( len ( s ) ) :
        sum_char += ord ( s [ i ] )
    return sum_char // len ( s )
if __name__ == " _ _ main _ _ " :
    s = " GeeksforGeeks "
    print ( averageValue ( s ) )

Index/key variables: i
Accumulator variables: sum_char
Iterator variables: i
Python program:
def check ( s , l ) :
    freq = [ 0 for i in range ( 26 ) ]
    for i in range ( l ) :
        freq [ ord ( s [ i ] ) - ord ( ' a ' ) ] += 1
    for i in range ( 26 ) :
        if ( freq [ i ] >= 2 ) :
            return True
    return False
if __name__ == ' _ _ main _ _ ' :
    s = " geeksforgeeks "
    l = len ( s )
    if ( check ( s , l ) ) :
        print ( " YES " )
    else :
        print ( " NO " )

Index/key variables: i
Iterator variables: i
Python program:
def predictWinner ( score , n ) :
    count = [ 0 for i in range ( 2 ) ]
    for i in range ( 0 , len ( score ) , 1 ) :
        index = ord ( score [ i ] ) - ord ( '0' )
        count [ index ] += 1
        if ( count [ 0 ] == n and count [ 1 ] < n - 1 ) :
            print ( " GEEKS ▁ lost " , end = " ▁ " )
            return
        if ( count [ 1 ] == n and count [ 0 ] < n - 1 ) :
            print ( " GEEKS ▁ won " , end = " ▁ " )
            return
        if ( count [ 0 ] == n - 1 and count [ 1 ] == n - 1 ) :
            count [ 0 ] = 0
            count [ 1 ] = 0
            break
    i += 1
    for i in range ( i , len ( score ) , 1 ) :
        index = ord ( score [ i ] ) - ord ( '0' )
        count [ index ] += 1
        if ( abs ( count [ 0 ] - count [ 1 ] ) == 2 ) :
            if ( count [ 0 ] > count [ 1 ] ) :
                print ( " GEEKS ▁ lost " , end = " ▁ " )
            else :
                print ( " GEEKS ▁ won " , end = " ▁ " ) ;
            return
if __name__ == ' _ _ main _ _ ' :
    score = "1001010101111011101111"
    n = 15
    predictWinner ( score , n )

Index/key variables: i, index
Iterator variables: i
Python program:
def isPalindrome ( str , l , r ) :
    while ( l < r ) :
        if ( str [ l ] != str [ r ] ) :
            return False
        l += 1
        r -= 1
    return True
def CyclicShifts ( str ) :
    n = len ( str )
    left = 0
    right = n - 1
    str = str + str
    cnt = 0
    while ( right < 2 * n - 1 ) :
        if ( isPalindrome ( str , left , right ) ) :
            break
        cnt += 1
        left += 1
        right += 1
    return cnt
if __name__ == " _ _ main _ _ " :
    str = " bccbbaab " ;
    print ( CyclicShifts ( str ) )

Index/key variables: l, r
Accumulator variables: cnt, left, right
Python program:
def printString ( n , str ) :
    str2 = " "
    extraChar = n % 26
    if ( extraChar >= 1 ) :
        for i in range ( 26 - ( extraChar + 1 ) , 26 ) :
            str2 += str [ i ]
    countOfStr = n // 26
    for i in range ( 1 , countOfStr + 1 ) :
        for j in range ( 26 ) :
            str2 += str [ j ]
    return str2
if __name__ == " _ _ main _ _ " :
    n = 30
    str = " zyxwvutsrqponmlkjihgfedcba "
    print ( printString ( n , str ) )

Index/key variables: i, j
Accumulator variables: str2
Iterator variables: i, j
Python program:
def commonPrefixUtil ( str1 , str2 ) :
    n1 = len ( str1 )
    n2 = len ( str2 )
    result = " "
    j = 0
    i = 0
    while ( i <= n1 - 1 and j <= n2 - 1 ) :
        if ( str1 [ i ] != str2 [ j ] ) :
            break
        result += ( str1 [ i ] )
        i += 1
        j += 1
    return ( result )
def commonPrefix ( arr , n ) :
    arr . sort ( reverse = False )
    print ( commonPrefixUtil ( arr [ 0 ] , arr [ n - 1 ] ) )
if __name__ == ' _ _ main _ _ ' :
    arr = [ " geeksforgeeks " , " geeks " , " geek " , " geezer " ]
    n = len ( arr )
    commonPrefix ( arr , n )

Index/key variables: i, j
Accumulator variables: result
Python program:
def countDigits ( st , n ) :
    if ( n > 0 ) :
        cnt = 1
        i = 0
        st2 = " "
        i = 1
        while ( i < len ( st ) ) :
            if ( st [ i ] == st [ i - 1 ] ) :
                cnt = cnt + 1
            else :
                st2 += chr ( 48 + cnt )
                st2 += st [ i - 1 ]
                cnt = 1
            i = i + 1
        st2 += chr ( 48 + cnt )
        st2 += st [ i - 1 ]
        countDigits ( st2 , n - 1 )
        n = n - 1 ;
    else :
        print ( st )
num = "123"
n = 3
countDigits ( num , n )

Index/key variables: i
Accumulator variables: st2
Python program:
from typing import List
def generateSubsequences ( input : str , output : str , idx : int , ans : List [ str ] ) -> None :
    if idx == len ( input ) :
        if ( len ( output ) ) :
            ans . append ( output )
        return
    generateSubsequences ( input , output , idx + 1 , ans )
    output += input [ idx ]
    generateSubsequences ( input , output , idx + 1 , ans )
    output = output [ : - 1 ]
    upper = input [ idx ]
    upper = upper . upper ( )
    output += upper
    generateSubsequences ( input , output , idx + 1 , ans )
def printSubsequences ( S : str ) -> None :
    output = " "
    ans = [ ]
    generateSubsequences ( S , output , 0 , ans )
    ans . sort ( )
    for string in ans :
        print ( string , end = " ▁ " )
if __name__ == " _ _ main _ _ " :
    S = " ab "
    printSubsequences ( S )

Index/key variables: idx, str
Iterator variables: string
Python program:
def match_words ( dictionary , sentence , n , m ) :
    mp = dict ( )
    for i in range ( n ) :
        mp [ dictionary [ i ] ] = mp . get ( dictionary [ i ] , 0 ) + 1
    for i in range ( m ) :
        if ( mp [ sentence [ i ] ] ) :
            mp [ sentence [ i ] ] -= 1
        else :
            return False
    return True
dictionary = [ " find " , " a " , " geeks " , " all " , " for " , " on " , " geeks " , " answers " , " inter " ]
n = len ( dictionary )
sentence = [ " find " , " all " , " answers " , " on " , " geeks " , " for " , " geeks " ]
m = len ( sentence )
if ( match_words ( dictionary , sentence , n , m ) ) :
    print ( " YES " )
else :
    print ( " NO " )

Index/key variables: i
Iterator variables: i
Python program:
def printNum ( s ) :
    i , j , val = 0 , 0 , 0
    mp = { }
    val = ( ( ord ( s [ 0 ] ) - ord ( '0' ) ) * 100 + ( ord ( s [ 1 ] ) - ord ( '0' ) ) * 10 + ( ord ( s [ 2 ] ) - ord ( '0' ) ) )
    mp [ val ] = 1
    for i in range ( 3 , len ( s ) ) :
        val = ( val % 100 ) * 10 + ord ( s [ i ] ) - ord ( '0' )
        if ( val in mp ) :
            mp [ val ] = mp [ val ] + 1
        else :
            mp [ val ] = 1
    for m in mp :
        key = m
        value = mp [ m ]
        if ( value > 1 ) :
            print ( key , " ▁ - ▁ " , value , " ▁ times " )
if __name__ == " _ _ main _ _ " :
    input = "123412345123456"
    printNum ( input )

Index/key variables: i, m, val
Iterator variables: i, m
Python program:
def hasAllcodes ( s , k ) :
    us = set ( )
    for i in range ( len ( s ) + 1 ) :
        us . add ( s [ i : k ] )
    return len ( us ) == 1 << k
s = "00110110"
k = 2
if ( hasAllcodes ) :
    print ( " YES " )
else :
    print ( " NO " )

Accumulator variables: us
Iterator variables: i
Python program:
def reverse ( string , start , end ) :
    temp = ' '
    while start <= end :
        temp = string [ start ]
        string [ start ] = string [ end ]
        string [ end ] = temp
        start += 1
        end -= 1
def reverseletter ( string , start , end ) :
    wstart , wend = start , start
    while wend < end :
        if string [ wend ] == " ▁ " :
            wend += 1
            continue
        while wend <= end and string [ wend ] != " ▁ " :
            wend += 1
        wend -= 1
        reverse ( string , wstart , wend )
        wend += 1
if __name__ == " _ _ main _ _ " :
    string = " Ashish ▁ Yadav ▁ Abhishek ▁ Rajput ▁ Sunil ▁ Pundir "
    string = list ( string )
    reverseletter ( string , 0 , len ( string ) - 1 )
    print ( ' ' . join ( string ) )

Index/key variables: end, start, wend
Python program:
def minimumFlip ( s , x , y ) :
    s = s + s
    isOpposite = False
    if ( x > y ) :
        temp = y
        y = x ;
        x = temp
        isOpposite = True
    valClockwise = 0
    cur = s [ x ]
    for i in range ( x , y + 1 , 1 ) :
        if ( s [ i ] != cur ) :
            cur = s [ i ]
            valClockwise += 1
    valAnticlockwise = 0
    cur = s [ y ]
    x += len ( s ) - 1
    for i in range ( y , x + 1 , 1 ) :
        if ( s [ i ] != cur ) :
            cur = s [ i ]
            valAnticlockwise += 1
    if ( valClockwise <= valAnticlockwise ) :
        if ( isOpposite == False ) :
            print ( " Clockwise " , valClockwise )
        else :
            print ( " Anti - clockwise " , valAnticlockwise )
    else :
        if ( isOpposite == False ) :
            print ( " Anti - clockwise " , valAnticlockwise )
        else :
            print ( " Clockwise " , valClockwise )
if __name__ == ' _ _ main _ _ ' :
    x = 0
    y = 8
    s = "000110"
    minimumFlip ( s , x , y )

Index/key variables: i, x, y
Accumulator variables: valAnticlockwise, valClockwise
Iterator variables: i
Boolean variables: isOpposite