dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; int CountSpecialPalindrome ( string str ) { int n = str . length ( ) ; int result = 0 ; int sameChar [ n ] = { 0 } ; int i = 0 ; while ( i < n ) { int sameCharCount = 1 ; int j = i + 1 ; while ( str [ i ] == str [ j ] && j < n ) sameCharCount ++ , j ++ ; result += ( sameCharCount * ( sameCharCount + 1 ) / 2 ) ; sameChar [ i ] = sameCharCount ; i = j ; } for ( int j = 1 ; j < n ; j ++ ) { if ( str [ j ] == str [ j - 1 ] ) sameChar [ j ] = sameChar [ j - 1 ] ; if ( j > 0 && j < ( n - 1 ) && ( str [ j - 1 ] == str [ j + 1 ] && str [ j ] != str [ j - 1 ] ) ) result += min ( sameChar [ j - 1 ] , sameChar [ j + 1 ] ) ; } return result - n ; } int main ( ) { string str = " abccba " ; cout << CountSpecialPalindrome ( str ) << endl ; return 0 ; }

Index/key variables: i, j, n
Accumulator variables: j, result, sameCharCount, stdc
Iterator variables: j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printBracketNumber ( string exp , int n ) { int left_bnum = 1 ; stack < int > right_bnum ; for ( int i = 0 ; i < n ; i ++ ) { if ( exp [ i ] == ' ( ' ) { cout << left_bnum << " ▁ " ; right_bnum . push ( left_bnum ) ; left_bnum ++ ; } else if ( exp [ i ] == ' ) ' ) { cout << right_bnum . top ( ) << " ▁ " ; right_bnum . pop ( ) ; } } } int main ( ) { string exp = " ( a + ( b * c ) ) + ( d / e ) " ; int n = exp . size ( ) ; printBracketNumber ( exp , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, left_bnum, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isCornerPresent ( string str , string corner ) { int n = str . length ( ) ; int cl = corner . length ( ) ; if ( n < cl ) return false ; return ( str . substr ( 0 , cl ) . compare ( corner ) == 0 && str . substr ( n - cl , cl ) . compare ( corner ) == 0 ) ; } int main ( ) { string str = " geeksforgeeks " ; string corner = " geeks " ; if ( isCornerPresent ( str , corner ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void binary_conversion ( string & s , int m ) { while ( m ) { int tmp = m % 2 ; s += tmp + '0' ; m = m / 2 ; } reverse ( s . begin ( ) , s . end ( ) ) ; } int find_character ( int n , int m , int i ) { string s ; binary_conversion ( s , m ) ; string s1 = " " ; for ( int x = 0 ; x < n ; x ++ ) { for ( int y = 0 ; y < s . length ( ) ; y ++ ) { if ( s [ y ] == '1' ) s1 += "10" ; else s1 += "01" ; } s = s1 ; s1 = " " ; } return s [ i ] - '0' ; } int main ( ) { int m = 5 , n = 2 , i = 8 ; cout << find_character ( n , m , i ) ; return 0 ; }

Index/key variables: i, y
Accumulator variables: s, s1, stdc, x, y
Iterator variables: x, y
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findMaxSegment ( string & s , int k ) { int seg_len = s . length ( ) - k ; int res = 0 ; for ( int i = 0 ; i < seg_len ; i ++ ) res = res * 10 + ( s [ i ] - '0' ) ; int seg_len_pow = pow ( 10 , seg_len - 1 ) ; int curr_val = res ; for ( int i = 1 ; i <= ( s . length ( ) - seg_len ) ; i ++ ) { curr_val = curr_val - ( s [ i - 1 ] - '0' ) * seg_len_pow ; curr_val = curr_val * 10 + ( s [ i + seg_len - 1 ] - '0' ) ; res = max ( res , curr_val ) ; } return res ; } int main ( ) { string s = "8754" ; int k = 2 ; cout << " Maximum ▁ number ▁ = ▁ " << findMaxSegment ( s , k ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; int isConsecutive ( string str ) { int start ; int length = str . size ( ) ; for ( int i = 0 ; i < length / 2 ; i ++ ) { string new_str = str . substr ( 0 , i + 1 ) ; int num = atoi ( new_str . c_str ( ) ) ; start = num ; while ( new_str . size ( ) < length ) { num ++ ; new_str = new_str + to_string ( num ) ; } if ( new_str == str ) return start ; } return -1 ; } int main ( ) { string str = "99100" ; cout << " String : ▁ " << str << endl ; int start = isConsecutive ( str ) ; if ( start != -1 ) cout << " Yes ▁ STRNEWLINE " << start << endl ; else cout << " No " << endl ; string str1 = "121315" ; cout << " String : " start = isConsecutive ( str1 ) ; if ( start != -1 ) cout << " Yes ▁ STRNEWLINE " << start << endl ; else cout << " No " << endl ; return 0 ; }

Accumulator variables: i, num
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isConvertible ( string str1 , string str2 , int k ) { if ( ( str1 . length ( ) + str2 . length ( ) ) < k ) return true ; int commonLength = 0 ; for ( int i = 0 ; i < min ( str1 . length ( ) , str2 . length ( ) ) ; i ++ ) { if ( str1 [ i ] == str2 [ i ] ) commonLength ++ ; else break ; } if ( ( k - str1 . length ( ) - str2 . length ( ) + 2 * commonLength ) % 2 == 0 ) return true ; return false ; } int main ( ) { string str1 = " geek " , str2 = " geek " ; int k = 7 ; if ( isConvertible ( str1 , str2 , k ) ) cout << " Yes " ; else cout << " No " ; str1 = " geeks " , str2 = " geek " ; k = 5 ; cout << endl ; if ( isConvertible ( str1 , str2 , k ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Index/key variables: i
Accumulator variables: commonLength, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX_CHAR  26
int maxLower ( string str ) { int n = str . length ( ) ; int i = 0 ; for ( ; i < n ; i ++ ) { if ( str [ i ] >= ' A ' && str [ i ] <= ' Z ' ) { i ++ ; break ; } } int maxCount = 0 ; int count [ MAX_CHAR ] = { 0 } ; for ( ; i < n ; i ++ ) { if ( str [ i ] >= ' A ' && str [ i ] <= ' Z ' ) { int currCount = 0 ; for ( int j = 0 ; j < MAX_CHAR ; j ++ ) if ( count [ j ] > 0 ) currCount ++ ; maxCount = max ( maxCount , currCount ) ; memset ( count , 0 , sizeof ( count ) ) ; } if ( str [ i ] >= ' a ' && str [ i ] <= ' z ' ) count [ str [ i ] - ' a ' ] ++ ; } return maxCount ; } int main ( ) { string str = " zACaAbbaazzC " ; cout << maxLower ( str ) ; return 0 ; }

Index/key variables: MAX_CHAR, i, j
Accumulator variables: currCount, i, j, stdc
Iterator variables: j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int maxLower ( string str ) { int n = str . length ( ) ; int i = 0 ; for ( ; i < n ; i ++ ) { if ( str [ i ] >= ' A ' && str [ i ] <= ' Z ' ) { i ++ ; break ; } } int maxCount = 0 ; unordered_set < int > s ; for ( ; i < n ; i ++ ) { if ( str [ i ] >= ' A ' && str [ i ] <= ' Z ' ) { maxCount = max ( maxCount , ( int ) s . size ( ) ) ; s . clear ( ) ; } if ( str [ i ] >= ' a ' && str [ i ] <= ' z ' ) s . insert ( str [ i ] ) ; } return maxCount ; } int main ( ) { string str = " zACaAbbaazzC " ; cout << maxLower ( str ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; char first ( string str ) { for ( int i = 0 ; i < str . length ( ) ; i ++ ) if ( isupper ( str [ i ] ) ) return str [ i ] ; return 0 ; } int main ( ) { string str = " geeksforGeeKS " ; char res = first ( str ) ; if ( res == 0 ) cout << " No ▁ uppercase ▁ letter " ; else cout << res << " STRNEWLINE " ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int fact ( int n ) { int ans = 1 ; for ( int i = 1 ; i <= n ; i ++ ) ans = ans * i ; return ( ans ) ; } int numberOfPossiblePallindrome ( string str , int n ) { unordered_map < char , int > mp ; for ( int i = 0 ; i < n ; i ++ ) mp [ str [ i ] ] ++ ; int fi ; for ( auto it = mp . begin ( ) ; it != mp . end ( ) ; ++ it ) { if ( it -> second % 2 == 0 ) fi = it -> second / 2 ; else { fi = ( it -> second - 1 ) / 2 ; k ++ ; } num = num + fi ; den = den * fact ( fi ) ; } if ( num != 0 ) num = fact ( num ) ; int ans = num / den ; if ( k != 0 ) { ans = ans * k ; } return ( ans ) ; } int main ( ) { char str [ ] = " ababab " ; int n = strlen ( str ) ; cout << numberOfPossiblePallindrome ( str , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, k, stdc
Iterator variables: i, it
C++ program:
#include <bits/stdc++.h>
using namespace std ; int evenDecimalValue ( string str , int n ) { int result = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { int decimalValue = 0 ; int powerOf2 = 1 ; for ( int k = i ; k <= j ; k ++ ) { decimalValue += ( ( str [ k ] - '0' ) * powerOf2 ) ; powerOf2 *= 2 ; } if ( decimalValue % 2 == 0 ) result ++ ; } } return result ; } int main ( ) { string str = "10010" ; int n = 5 ; cout << evenDecimalValue ( str , n ) << endl ; return 0 ; }

Index/key variables: k
Accumulator variables: decimalValue, i, j, k, powerOf2, result, stdc
Iterator variables: i, j, k
C++ program:
#include <bits/stdc++.h>
using namespace std ; void solve ( string s ) { int l = s . length ( ) ; int x = l / 2 ; int y = l ; string p = " " ; while ( x > 0 && y > l / 2 ) { p += s [ x - 1 ] ; x -- ; p += s [ y - 1 ] ; y -- ; } if ( y > l / 2 ) { p += s [ y - 1 ] ; y -- ; } cout << p ; } int main ( ) { string s = " sunshine " ; solve ( s ) ; return 0 ; }

Accumulator variables: p, stdc, x, y
C++ program:
#include <bits/stdc++.h>
using namespace std ; int Palindrome ( string s , int n ) { unordered_map < char , int > cnt ; string R = " " ; for ( int i = 0 ; i < n ; i ++ ) { char a = s [ i ] ; cnt [ a ] ++ ; } for ( char i = ' a ' ; i <= ' z ' ; i ++ ) { if ( cnt [ i ] % 2 != 0 ) R += i ; } int l = R . length ( ) ; int j = 0 ; for ( int i = l - 1 ; i >= l / 2 ; i -- ) { cnt [ R [ i ] ] -- ; R [ i ] = R [ j ] ; cnt [ R [ j ] ] ++ ; j ++ ; } string first , middle , second ; for ( char i = ' a ' ; i <= ' z ' ; i ++ ) { if ( cnt [ i ] != 0 ) { if ( cnt [ i ] % 2 == 0 ) { int j = 0 ; while ( j < cnt [ i ] / 2 ) { first += i ; j ++ ; } } else { int j = 0 ; while ( j < ( cnt [ i ] - 1 ) / 2 ) { first += i ; j ++ ; } middle += i ; } } } second = first ; reverse ( second . begin ( ) , second . end ( ) ) ; string resultant = first + middle + second ; cout << resultant << endl ; } int main ( ) { string S = " geeksforgeeks " ; int n = S . length ( ) ; Palindrome ( S , n ) ; return 0 ; }

Index/key variables: a, i, j
Accumulator variables: R, first, i, j, middle, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int recLen ( char * str ) { if ( * str == ' \0' ) return 0 ; else return 1 + recLen ( str + 1 ) ; } int main ( ) { char str [ ] = " GeeksforGeeks " ; cout << recLen ( str ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
using namespace std ; bool isConsonant ( char ch ) { ch = toupper ( ch ) ; return ! ( ch == ' A ' ch == ' E ' ch == ' I ' ch == ' O ' ch == ' U ' ) && ch >= 65 && ch <= 90 ; } int totalConsonants ( string str ) { int count = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) if ( isConsonant ( str [ i ] ) ) ++ count ; return count ; } int main ( ) { string str = " abc ▁ de " ; cout << totalConsonants ( str ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; unsigned int reverseBits ( unsigned int n ) { unsigned int rev = 0 ; while ( n > 0 ) { rev <<= 1 ; if ( n & 1 == 1 ) rev ^= 1 ; n >>= 1 ; } return rev ; } bool isPalindrome ( unsigned int n ) { unsigned int rev = reverseBits ( n ) ; return ( n == rev ) ; } int main ( ) { unsigned int n = 9 ; if ( isPalindrome ( n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: rev, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  26
void Swap ( string s , string t , int n ) { int dp [ MAX ] [ MAX ] ; memset ( dp , -1 , sizeof dp ) ; int tot = 0 ; for ( int i = 0 ; i < n ; i ++ ) if ( s [ i ] != t [ i ] ) tot ++ ; for ( int i = 0 ; i < n ; i ++ ) { int a = s [ i ] - ' a ' ; int b = t [ i ] - ' a ' ; if ( a == b ) continue ; if ( dp [ a ] [ b ] != -1 ) { cout << i + 1 << " ▁ " << dp [ a ] [ b ] + 1 << endl ; return ; } dp [ b ] [ a ] = i ; } int A [ MAX ] , B [ MAX ] ; memset ( A , -1 , sizeof A ) ; memset ( B , -1 , sizeof B ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = s [ i ] - ' a ' ; int b = t [ i ] - ' a ' ; if ( a == b ) continue ; if ( A [ b ] != -1 ) { cout << i + 1 << " ▁ " << A [ b ] + 1 << endl ; return ; } if ( B [ a ] != -1 ) { cout << i + 1 << " ▁ " << B [ a ] + 1 << endl ; return ; } A [ a ] = i ; B [ b ] = i ; } cout << -1 << endl ; } int main ( ) { string S = " permanent " ; string T = " pergament " ; int n = S . length ( ) ; if ( S == " " T == " " ) cout << " Required ▁ string ▁ is ▁ empty . " ; else Swap ( S , T , n ) ; return 0 ; }

Index/key variables: MAX, a, b, i
Accumulator variables: i, stdc, tot
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  26
void printAnagramAndChanges ( string X , string Y ) { int countx [ MAX ] = { 0 } , county [ MAX ] = { 0 } , ctrx [ MAX ] = { 0 } , ctry [ MAX ] = { 0 } ; int change = 0 ; int l = X . length ( ) ; for ( int i = 0 ; i < l ; i ++ ) { countx [ X [ i ] - ' A ' ] ++ ; county [ Y [ i ] - ' A ' ] ++ ; } for ( int i = 0 ; i < MAX ; i ++ ) { if ( countx [ i ] > county [ i ] ) ctrx [ i ] += ( countx [ i ] - county [ i ] ) ; else if ( countx [ i ] < county [ i ] ) ctry [ i ] += ( county [ i ] - countx [ i ] ) ; change += abs ( county [ i ] - countx [ i ] ) ; } for ( int i = 0 ; i < l ; i ++ ) { if ( ctrx [ X [ i ] - ' A ' ] == 0 ) continue ; int j ; for ( j = 0 ; j < MAX ; j ++ ) if ( ( ctry [ j ] ) > 0 ) break ; if ( countx [ X [ i ] - ' A ' ] == ctrx [ X [ i ] - ' A ' ] X [ i ] - ' A ' > j ) { countx [ X [ i ] - ' A ' ] -- ; ctrx [ X [ i ] - ' A ' ] -- ; ctry [ j ] -- ; X [ i ] = ' A ' + j ; } else countx [ X [ i ] - ' A ' ] -- ; } cout << " Anagram ▁ : ▁ " << X << endl ; cout << " Number ▁ of ▁ changes ▁ made ▁ : ▁ " << change / 2 ; } int main ( ) { string x = " CDBABC " , y = " ADCABD " ; printAnagramAndChanges ( x , y ) ; return 0 ; }

Index/key variables: MAX, i, j
Accumulator variables: change, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  256
int countPairs ( string s ) { int cnt [ MAX ] = { 0 } ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) cnt [ s [ i ] ] ++ ; int ans = 0 ; for ( int i = 0 ; i < MAX ; i ++ ) ans += cnt [ i ] * cnt [ i ] ; return ans ; } int main ( ) { string s = " geeksforgeeks " ; cout << countPairs ( s ) ; return 0 ; }

Index/key variables: MAX, i
Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string lexNext ( string s , int n ) { for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( s [ i ] != ' z ' ) { s [ i ] ++ ; return s ; } s [ i ] = ' a ' ; } } int main ( ) { string S = " abcdeg " , T = " abcfgh " ; int n = S . length ( ) ; string res = lexNext ( S , n ) ; if ( res != T ) cout << res << endl ; else cout << " - 1" << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void solve ( int n , int t , string s ) { for ( int i = 0 ; i < t ; i ++ ) for ( int j = 0 ; j < n - 1 ; j ++ ) if ( s [ j ] == ' B ' && s [ j + 1 ] == ' G ' ) { char temp = s [ j ] ; s [ j ] = s [ j + 1 ] ; s [ j + 1 ] = temp ; j ++ ; } cout << s ; } int main ( ) { int n = 6 , t = 2 ; string s = " BBGBBG " ; solve ( n , t , s ) ; return 0 ; }

Index/key variables: j
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int calSumUtil ( int a [ ] , int b [ ] , int n , int m ) { int sum [ n ] ; int i = n - 1 , j = m - 1 , k = n - 1 ; int carry = 0 , s = 0 ; while ( j >= 0 ) { s = a [ i ] + b [ j ] + carry ; sum [ k ] = ( s % 10 ) ; carry = s / 10 ; k -- ; i -- ; j -- ; } while ( i >= 0 ) { s = a [ i ] + carry ; sum [ k ] = ( s % 10 ) ; carry = s / 10 ; i -- ; k -- ; } int ans = 0 ; if ( carry ) ans = 10 ; for ( int i = 0 ; i <= n - 1 ; i ++ ) { ans += sum [ i ] ; ans *= 10 ; } return ans / 10 ; } int calSum ( int a [ ] , int b [ ] , int n , int m ) { if ( n >= m ) return calSumUtil ( a , b , n , m ) ; else return calSumUtil ( b , a , m , n ) ; } int main ( ) { int a [ ] = { 9 , 3 , 9 } ; int b [ ] = { 6 , 1 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; int m = sizeof ( b ) / sizeof ( b [ 0 ] ) ; cout << calSum ( a , b , n , m ) << endl ; return 0 ; }

Index/key variables: i, j, k, n
Accumulator variables: ans, i, j, k, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define SIZE  26
int longCommomAnagramSubseq ( char str1 [ ] , char str2 [ ] , int n1 , int n2 ) { int freq1 [ SIZE ] , freq2 [ SIZE ] ; memset ( freq1 , 0 , sizeof ( freq1 ) ) ; memset ( freq2 , 0 , sizeof ( freq2 ) ) ; int len = 0 ; for ( int i = 0 ; i < n1 ; i ++ ) freq1 [ str1 [ i ] - ' a ' ] ++ ; for ( int i = 0 ; i < n2 ; i ++ ) freq2 [ str2 [ i ] - ' a ' ] ++ ; for ( int i = 0 ; i < SIZE ; i ++ ) len += min ( freq1 [ i ] , freq2 [ i ] ) ; return len ; } int main ( ) { char str1 [ ] = " abdacp " ; char str2 [ ] = " ckamb " ; int n1 = strlen ( str1 ) ; int n2 = strlen ( str2 ) ; cout << " Length ▁ = ▁ " << longCommomAnagramSubseq ( str1 , str2 , n1 , n2 ) ; return 0 ; }

Index/key variables: SIZE, i
Accumulator variables: i, len, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPanalphabeticWindow ( char s [ ] , int n ) { char ch = ' a ' ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] == ch ) ch ++ ; if ( ch == ' z ' + 1 ) return true ; } return false ; } int main ( ) { char s [ ] = " abujm ▁ zvcd ▁ acefc ▁ deghf ▁ gijkle " " ▁ m ▁ n ▁ o ▁ p ▁ pafqrstuvwxyzfap " ; int n = strlen ( s ) ; ( isPanalphabeticWindow ( s , n ) ) ? ( cout << " YES " ) : ( cout << " NO " ) ; return 0 ; }

Index/key variables: i
Accumulator variables: ch, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPrime ( int n ) { if ( n <= 1 ) return false ; for ( int i = 2 ; i < n ; i ++ ) if ( n % i == 0 ) return false ; return true ; } void prime_index ( string input ) { int n = input . length ( ) ; for ( int i = 2 ; i <= n ; i ++ ) if ( isPrime ( i ) ) cout << input [ i - 1 ] ; } int main ( ) { string input = " GeeksforGeeks " ; prime_index ( input ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isHeterogram ( char s [ ] , int n ) { int hash [ 26 ] = { 0 } ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] != ' ▁ ' ) { if ( hash [ s [ i ] - ' a ' ] == 0 ) hash [ s [ i ] - ' a ' ] = 1 ; else return false ; } } return true ; } int main ( ) { char s [ ] = " the ▁ big ▁ dwarf ▁ only ▁ jumps " ; int n = strlen ( s ) ; ( isHeterogram ( s , n ) ) ? ( cout << " YES " ) : ( cout << " NO " ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void ASCIISentence ( std :: string str ) { int l = str . length ( ) ; int convert ; for ( int i = 0 ; i < l ; i ++ ) { convert = str [ i ] - NULL ; cout << convert ; } } int main ( ) { string str = " GeeksforGeeks " ; cout << " ASCII ▁ Sentence : " << std :: endl ; ASCIISentence ( str ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void convert ( string str ) { int n = str . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( str . at ( i ) == ' ▁ ' ) str . at ( i ) = ' _ ' ; else str . at ( i ) = tolower ( str . at ( i ) ) ; } cout << str ; } int main ( ) { string str = " I ▁ got ▁ intern ▁ at ▁ geeksforgeeks " ; convert ( str ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int largestAnagramSet ( string arr [ ] , int n ) { int maxSize = 0 ; unordered_map < string , int > count ; for ( int i = 0 ; i < n ; ++ i ) { sort ( arr [ i ] . begin ( ) , arr [ i ] . end ( ) ) ; count [ arr [ i ] ] += 1 ; maxSize = max ( maxSize , count [ arr [ i ] ] ) ; } return maxSize ; } int main ( ) { string arr [ ] = { " ant " , " magenta " , " magnate " , " tan " , " gnamate " } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << largestAnagramSet ( arr , n ) << " STRNEWLINE " ; string arr1 [ ] = { " cars " , " bikes " , " arcs " , " steer " } ; n = sizeof ( arr1 ) / sizeof ( arr [ 0 ] ) ; cout << largestAnagramSet ( arr1 , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void countCharacterType ( string str ) { int vowels = 0 , consonant = 0 , specialChar = 0 , digit = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { char ch = str [ i ] ; if ( ( ch >= ' a ' && ch <= ' z ' ) || ( ch >= ' A ' && ch <= ' Z ' ) ) { ch = tolower ( ch ) ; if ( ch == ' a ' ch == ' e ' ch == ' i ' ch == ' o ' ch == ' u ' ) vowels ++ ; else consonant ++ ; } else if ( ch >= '0' && ch <= '9' ) digit ++ ; else specialChar ++ ; } cout << " Vowels : ▁ " << vowels << endl ; cout << " Consonant : ▁ " << consonant << endl ; cout << " Digit : ▁ " << digit << endl ; cout << " Special ▁ Character : ▁ " << specialChar << endl ; } int main ( ) { string str = " geeks ▁ for ▁ geeks121" ; countCharacterType ( str ) ; return 0 ; }

Index/key variables: i
Accumulator variables: consonant, digit, i, specialChar, stdc, vowels
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findNextWord ( string s , int m ) { m += 97 ; int n = s . length ( ) ; int i = s . length ( ) - 1 ; s [ i ] ++ ; while ( i >= 0 && i <= n - 1 ) { if ( s [ i ] >= m ) { s [ i ] = ' a ' ; s [ -- i ] ++ ; } else if ( s [ i ] == s [ i - 1 ] s [ i ] == s [ i - 2 ] ) s [ i ] ++ ; else i ++ ; } if ( i <= -1 ) cout << " - 1" ; else cout << s ; } int main ( ) { string str = " abcd " ; int k = 4 ; findNextWord ( str , k ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, m, stdc
C++ program:
#include <iostream>
#include <string>
using namespace std ; int Octal ( int decimal ) { int octal = 0 ; string temp = " " ; while ( decimal > 0 ) { int remainder = decimal % 8 ; temp = to_string ( remainder ) + temp ; decimal /= 8 ; } for ( int i = 0 ; i < temp . length ( ) ; i ++ ) octal = ( octal * 10 ) + ( temp [ i ] - '0' ) ; return octal ; } string Hexadecimal ( int decimal ) { string hex = " " ; while ( decimal > 0 ) { int remainder = decimal % 16 ; if ( remainder >= 0 && remainder <= 9 ) hex = to_string ( remainder ) + hex ; else hex = ( char ) ( ' A ' + remainder % 10 ) + hex ; decimal /= 16 ; } return hex ; } string HTML ( int decimal ) { string html = to_string ( decimal ) ; html = " & # " + html + " ; " ; return html ; } void ASCIIlookuptable ( char ch ) { int decimal = ch ; cout << " Octal ▁ value : ▁ " << Octal ( decimal ) << endl ; cout << " Decimal ▁ value : ▁ " << decimal << endl ; cout << " Hexadecimal ▁ value : ▁ " << Hexadecimal ( decimal ) << endl ; cout << " HTML ▁ value : ▁ " << HTML ( decimal ) ; } int main ( ) { char ch = ' @ ' ; ASCIIlookuptable ( ch ) ; return 0 ; }

Index/key variables: i
Accumulator variables: decimal, i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string replace ( string s , char c1 , char c2 ) { int l = s . length ( ) ; for ( int i = 0 ; i < l ; i ++ ) { if ( s [ i ] == c1 ) s [ i ] = c2 ; else if ( s [ i ] == c2 ) s [ i ] = c1 ; } return s ; } int main ( ) { string s = " grrksfoegrrks " ; char c1 = ' e ' , c2 = ' r ' ; cout << replace ( s , c1 , c2 ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string fibWord ( int n ) { string Sn_1 = "0" ; string Sn = "01" ; string tmp ; for ( int i = 2 ; i <= n ; i ++ ) { tmp = Sn ; Sn += Sn_1 ; Sn_1 = tmp ; } return Sn ; } int main ( ) { int n = 6 ; cout << fibWord ( n ) ; return 0 ; }

Accumulator variables: Sn, i, stdc
Iterator variables: i