dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static readonly int [ ] arr = { 1 , 2 , 3 , 1 , 2 , 3 , 1 , 2 , 3 , 1 , 2 , 3 , 1 , 2 , 3 , 1 , 2 , 3 , 4 , 1 , 2 , 3 , 1 , 2 , 3 , 4 } ; public static int countKeyPressed ( String str , int len ) { int count = 0 ; for ( int i = 0 ; i < len ; i ++ ) count = count + arr [ str [ i ] - ' a ' ] ; return count ; } public static void Main ( ) { String str = " abcdef " ; int len = str . Length ; Console . Write ( countKeyPressed ( str , len ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isReverseEqual ( String s1 , String s2 ) { if ( s1 . Length != s2 . Length ) return false ; int len = s1 . Length ; for ( int i = 0 ; i < len ; i ++ ) if ( s1 [ i ] != s2 [ len - i - 1 ] ) return false ; return true ; } static String getWord ( String [ ] str , int n ) { for ( int i = 0 ; i < n - 1 ; i ++ ) for ( int j = i + 1 ; j < n ; j ++ ) if ( isReverseEqual ( str [ i ] , str [ j ] ) ) return str [ i ] ; return " - 1" ; } public static void Main ( String [ ] args ) { String [ ] str = { " geeks " , " for " , " skeeg " } ; int n = str . Length ; Console . Write ( getWord ( str , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPrefix ( String str , int len , int i , int k ) { if ( i + k > len ) return false ; for ( int j = 0 ; j < k ; j ++ ) { if ( str [ i ] != str [ j ] ) return false ; i ++ ; } return true ; } static bool isKPeriodic ( String str , int len , int k ) { for ( int i = k ; i < len ; i += k ) if ( ! isPrefix ( str , len , i , k ) ) return false ; return true ; } public static void Main ( ) { String str = " geeksgeeks " ; int len = str . Length ; int k = 5 ; if ( isKPeriodic ( str , len , k ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int minLettersNeeded ( int n ) { if ( n % 26 == 0 ) return ( n / 26 ) ; else return ( ( n / 26 ) + 1 ) ; } public static void Main ( ) { int n = 52 ; Console . Write ( minLettersNeeded ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static String findMaxLenEven ( string str ) { int n = str . Length ; int i = 0 ; int currlen = 0 ; int maxlen = 0 ; int st = - 1 ; while ( i < n ) { if ( str [ i ] == ' ▁ ' ) { if ( currlen % 2 == 0 ) { if ( maxlen < currlen ) { maxlen = currlen ; st = i - currlen ; } } currlen = 0 ; } else { currlen ++ ; } i ++ ; } if ( currlen % 2 == 0 ) { if ( maxlen < currlen ) { maxlen = currlen ; st = i - currlen ; } } if ( st == - 1 ) return " - 1" ; return str . Substring ( st , maxlen ) ; } public static void Main ( ) { string str = " this ▁ is ▁ a ▁ test ▁ string " ; Console . WriteLine ( findMaxLenEven ( str ) ) ; } }

Index/key variables: i
Accumulator variables: currlen, i
Class/struct names: GFG
C# program:
using System ; class GFG { static String findMinLenStr ( string str , int k ) { int n = str . Length ; int st = 0 ; int end = 0 ; int [ ] cnt = new int [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) cnt [ i ] = 0 ; int distEle = 0 ; int currlen ; int minlen = n ; int startInd = - 1 ; while ( end < n ) { cnt [ str [ end ] - ' a ' ] ++ ; if ( cnt [ str [ end ] - ' a ' ] == 1 ) distEle ++ ; if ( distEle > k ) { while ( st < end && distEle > k ) { if ( cnt [ str [ st ] - ' a ' ] == 1 ) distEle -- ; cnt [ str [ st ] - ' a ' ] -- ; st ++ ; } } if ( distEle == k ) { while ( st < end && cnt [ str [ st ] - ' a ' ] > 1 ) { cnt [ str [ st ] - ' a ' ] -- ; st ++ ; } currlen = end - st + 1 ; if ( currlen < minlen ) { minlen = currlen ; startInd = st ; } } end ++ ; } return str . Substring ( startInd , minlen ) ; } public static void Main ( ) { string str = " efecfefd " ; int k = 4 ; Console . WriteLine ( findMinLenStr ( str , k ) ) ; } }

Index/key variables: end, i, st
Accumulator variables: distEle, end, i, st
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minReplacement ( String s , int len ) { int ans = 0 ; for ( int i = 0 ; i < len ; i ++ ) { if ( i % 2 == 0 && s [ i ] == '1' ) ans ++ ; if ( i % 2 == 1 && s [ i ] == '0' ) ans ++ ; } return Math . Min ( ans , len - ans ) ; } public static void Main ( String [ ] args ) { String s = "1100" ; int len = s . Length ; Console . Write ( minReplacement ( s , len ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int substrDeletion ( string str , int len ) { int count0 = 0 , count1 = 0 ; for ( int i = 0 ; i < len ; i ++ ) { if ( str [ i ] == '0' ) count0 ++ ; else count1 ++ ; } return Math . Min ( count0 , count1 ) ; } public static void Main ( ) { string str = "010" ; int len = str . Length ; Console . Write ( substrDeletion ( str , len ) ) ; } }

Index/key variables: i
Accumulator variables: count0, count1, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String groupCharacters ( char [ ] s , int len ) { string temp = " " ; for ( int j = 0 ; j < len ; j ++ ) if ( s [ j ] != ' ▁ ' ) temp = temp + s [ j ] ; len = temp . Length ; string ans = " " ; int i = 0 ; while ( i < len ) { if ( temp [ i ] >= ( ' A ' ) && temp [ i ] <= ( ' Z ' ) ) { while ( i < len && temp [ i ] >= ( ' A ' ) && temp [ i ] <= ( ' Z ' ) ) { ans = ans + temp [ i ] ; i ++ ; } ans = ans + " ▁ " ; } else if ( temp [ i ] >= ( '0' ) && temp [ i ] <= ( '9' ) ) { while ( i < len && temp [ i ] >= ( '0' ) && temp [ i ] <= ( '9' ) ) { ans = ans + temp [ i ] ; i ++ ; } ans = ans + " ▁ " ; } else { while ( i < len && temp [ i ] >= ( ' * ' ) && temp [ i ] <= ( ' / ' ) ) { ans = ans + temp [ i ] ; i ++ ; } ans = ans + " ▁ " ; } } return ans ; } public static void Main ( ) { string s = "34FTG234 + ▁ + - ▁ * " ; int len = s . Length ; Console . WriteLine ( groupCharacters ( s . ToCharArray ( ) , len ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int Preprocess ( string A , string B ) { int n = A . Length ; int ans = 0 ; for ( int i = 0 ; i < n / 2 ; i ++ ) { Dictionary < char , int > mp = new Dictionary < char , int > ( ) ; if ( mp . ContainsKey ( A [ i ] ) ) mp [ A [ i ] ] ++ ; else mp [ A [ i ] ] = 1 ; if ( mp . ContainsKey ( A [ n - i - 1 ] ) ) mp [ A [ n - i - 1 ] ] ++ ; else mp [ A [ n - i - 1 ] ] = 1 ; if ( mp . ContainsKey ( B [ i ] ) ) mp [ B [ i ] ] ++ ; else mp [ B [ i ] ] = 1 ; if ( mp . ContainsKey ( B [ n - i - 1 ] ) ) mp [ B [ n - i - 1 ] ] ++ ; else mp [ B [ n - i - 1 ] ] = 1 ; int sz = mp . Count ; if ( sz == 4 ) ans += 2 ; else if ( sz == 3 ) ans += 1 + ( A [ i ] == A [ n - i - 1 ] ? 1 : 0 ) ; else if ( sz == 2 ) ans += mp [ A [ i ] ] != 2 ? 1 : 0 ; } if ( n % 2 == 1 && A [ n / 2 ] != B [ n / 2 ] ) ans ++ ; return ans ; } public static void Main ( ) { string A = " abacaba " , B = " bacabaa " ; Console . WriteLine ( Preprocess ( A , B ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String leastLexiString ( String s ) { if ( s . Length == 1 ) return s ; String x = leastLexiString ( s . Substring ( 0 , s . Length / 2 ) ) ; String y = leastLexiString ( s . Substring ( s . Length / 2 ) ) ; return ( ( x + y ) . CompareTo ( y + x ) . ToString ( ) ) ; } static Boolean areEquivalent ( String a , String b ) { return ! ( leastLexiString ( a ) . Equals ( leastLexiString ( b ) ) ) ; } public static void Main ( String [ ] args ) { String a = " aaba " ; String b = " abaa " ; if ( areEquivalent ( a , b ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; a = " aabb " ; b = " abab " ; if ( areEquivalent ( a , b ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GfG { static bool isVowel ( char c ) { if ( c == ' a ' c == ' e ' c == ' i ' c == ' o ' c == ' u ' ) return true ; return false ; } static bool checkPossibility ( string s1 , string s2 ) { int l1 = s1 . Length ; int l2 = s2 . Length ; if ( l1 != l2 ) return false ; for ( int i = 0 ; i < l1 ; i ++ ) { if ( isVowel ( s1 [ i ] ) && isVowel ( s2 [ i ] ) ) continue ; else if ( ! ( isVowel ( s1 [ i ] ) ) && ! ( isVowel ( s2 [ i ] ) ) ) continue ; else return false ; } return true ; } public static void Main ( ) { string S1 = " abcgle " ; string S2 = " ezggli " ; if ( checkPossibility ( S1 , S2 ) == true ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; class GFG { static void generateString ( int A , int B ) { string rt = " " ; while ( 0 < A 0 < B ) { if ( A < B ) { if ( 0 < B -- ) { rt += ( ' b ' ) ; } if ( 0 < B -- ) { rt += ( ' b ' ) ; } if ( 0 < A -- ) { rt += ( ' a ' ) ; } } else if ( B < A ) { if ( 0 < A -- ) { rt += ( ' a ' ) ; } if ( 0 < A -- ) { rt += ( ' a ' ) ; } if ( 0 < B -- ) { rt += ( ' b ' ) ; } } else { if ( 0 < A -- ) { rt += ( ' a ' ) ; } if ( 0 < B -- ) { rt += ( ' b ' ) ; } } } Console . WriteLine ( rt ) ; } public static void Main ( ) { int A = 2 , B = 6 ; generateString ( A , B ) ; } }

Accumulator variables: A, B, rt
Class/struct names: GFG
C# program:
using System ; class GFG { static String getSubSeq ( String s , int n ) { String res = " " ; int cr = 0 ; while ( cr < n ) { char mx = s [ cr ] ; for ( int i = cr + 1 ; i < n ; i ++ ) { mx = ( char ) Math . Max ( mx , s [ i ] ) ; } int lst = cr ; for ( int i = cr ; i < n ; i ++ ) { if ( s [ i ] == mx ) { res += s [ i ] ; lst = i ; } } cr = lst + 1 ; } return res ; } public static void Main ( String [ ] args ) { String s = " geeksforgeeks " ; int n = s . Length ; Console . WriteLine ( getSubSeq ( s , n ) ) ; } }

Index/key variables: cr, i
Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countMinimalReplacements ( String s ) { int n = s . Length ; int mini = int . MaxValue ; char [ ] dup = "012" . ToCharArray ( ) ; do { int dif = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] != dup [ i % 3 ] ) { dif ++ ; } } mini = Math . Min ( mini , dif ) ; } while ( next_permutation ( dup ) ) ; return mini ; } static bool next_permutation ( char [ ] p ) { for ( int a = p . Length - 2 ; a >= 0 ; -- a ) { if ( p [ a ] < p [ a + 1 ] ) { for ( int b = p . Length - 1 ; ; -- b ) { if ( p [ b ] > p [ a ] ) { char t = p [ a ] ; p [ a ] = p [ b ] ; p [ b ] = t ; for ( ++ a , b = p . Length - 1 ; a < b ; ++ a , -- b ) { t = p [ a ] ; p [ a ] = p [ b ] ; p [ b ] = t ; } return true ; } } } } return false ; } public static void Main ( String [ ] args ) { String s = "2101200" ; Console . WriteLine ( countMinimalReplacements ( s ) ) ; } }

Index/key variables: a, b, i
Accumulator variables: dif, i
Iterator variables: a, b, i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countSubStr ( String str , int len , int k ) { int count = 0 ; for ( int i = 0 ; i < len ; i ++ ) { int n = 0 ; for ( int j = i ; j < len ; j ++ ) { n = n * 10 + ( str [ j ] - '0' ) ; if ( n % k == 0 ) count ++ ; } } return count ; } public static void Main ( ) { String str = "33445" ; int len = str . Length ; int k = 11 ; Console . WriteLine ( countSubStr ( str , len , k ) ) ; } }

Index/key variables: j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static char Colour_Combination ( string s ) { char temp = s [ 0 ] ; for ( int i = 1 ; i < s . Length ; i ++ ) { if ( temp != s [ i ] ) { if ( ( temp == ' B ' temp == ' G ' ) && ( s [ i ] == ' G ' s [ i ] == ' B ' ) ) temp = ' Y ' ; else if ( ( temp == ' B ' temp == ' Y ' ) && ( s [ i ] == ' Y ' s [ i ] == ' B ' ) ) temp = ' G ' ; else temp = ' B ' ; } } return temp ; } static void Main ( ) { string s = " GBYGB " ; Console . WriteLine ( Colour_Combination ( s ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void reverse ( string str , int x ) { int n = ( str . Length - x ) / 2 ; for ( int i = 0 ; i < n ; i ++ ) Console . Write ( str [ i ] ) ; for ( int i = n + x - 1 ; i >= n ; i -- ) Console . Write ( str [ i ] ) ; for ( int i = n + x ; i < str . Length ; i ++ ) Console . Write ( str [ i ] ) ; } public static void Main ( ) { string str = " geeksforgeeks " ; int x = 3 ; reverse ( str , x ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Text ; class GFG { static string lexoSmallest ( string str , int n ) { int ca = 0 , cb = 0 , cc = 0 ; StringBuilder s = new StringBuilder ( str ) ; for ( int j = 0 ; j < n ; j ++ ) { if ( s [ j ] == ' a ' ) ca ++ ; else if ( s [ j ] == ' b ' ) cb ++ ; else cc ++ ; } if ( ca == cb && cb == cc ) { return s . ToString ( ) ; } int cnt = n / 3 ; if ( cnt * 3 != n ) { return " - 1" ; } int i = 0 ; while ( ca < cnt && i < n ) { if ( s [ i ] == ' b ' && cb > cnt ) { cb -- ; s [ i ] = ' a ' ; ca ++ ; } else if ( s [ i ] == ' c ' && cc > cnt ) { cc -- ; s [ i ] = ' a ' ; ca ++ ; } i ++ ; } i = 0 ; while ( cb < cnt && i < n ) { if ( s [ i ] == ' c ' && cc > cnt ) { cc -- ; s [ i ] = '1' ; cb ++ ; } i ++ ; } i = n - 1 ; while ( cc < cnt && i >= 0 ) { if ( s [ i ] == ' a ' && ca > cnt ) { ca -- ; s [ i ] = ' c ' ; cc ++ ; } i -- ; } i = n - 1 ; while ( cb < cnt && i >= 0 ) { if ( s [ i ] == ' a ' && ca > cnt ) { ca -- ; s [ i ] = ' b ' ; cb ++ ; } i -- ; } i = n - 1 ; while ( cc < cnt && i >= 0 ) { if ( s [ i ] == ' b ' && cb > cnt ) { cb -- ; s [ i ] = ' c ' ; cc ++ ; } i -- ; } return s . ToString ( ) ; } public static void Main ( string [ ] args ) { string s = " aaaaaa " ; int n = s . Length ; Console . Write ( lexoSmallest ( s , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: ca, cb, cc, i, j
Iterator variables: j
Class/struct names: GFG
C# program:
using System ; class GFG { static int getSteps ( string str , int i , int j , int n ) { int k = i + 1 ; int steps = 0 ; char ch = str [ i ] ; while ( k <= j ) { if ( str [ k ] != ch ) { steps ++ ; ch = str [ k ] ; } k ++ ; } return steps ; } static int getMinSteps ( string str , int i , int j , int n ) { if ( j < i ) { int temp = i ; i = j ; j = temp ; } int stepsToRight = getSteps ( str , i , j , n ) ; int stepsToLeft = getSteps ( str , 0 , i , n ) + getSteps ( str , j , n - 1 , n ) ; if ( str [ 0 ] != str [ n - 1 ] ) stepsToLeft ++ ; return Math . Min ( stepsToLeft , stepsToRight ) ; } public static void Main ( ) { string str = " SSNSS " ; int n = str . Length ; int i = 0 , j = 3 ; Console . WriteLine ( getMinSteps ( str , i , j , n ) ) ; } }

Index/key variables: i, k
Accumulator variables: k, steps, stepsToLeft
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int MAX_CHAR = 256 ; static int countSubStrings ( String s , String anotherStr , int k ) { bool [ ] illegal = new bool [ MAX_CHAR ] ; for ( int i = 0 ; i < anotherStr . Length ; i ++ ) { illegal [ anotherStr [ i ] ] = true ; } HashSet < String > us = new HashSet < String > ( ) ; for ( int i = 0 ; i < s . Length ; ++ i ) { String ss = " " ; int count = 0 ; for ( int j = i ; j < s . Length ; ++ j ) { if ( illegal [ s [ j ] ] ) { ++ count ; } ss = ss + s [ j ] ; if ( count <= k ) { us . Add ( ss ) ; } else { break ; } } } return us . Count ; } public static void Main ( ) { String str = " acbacbacaa " ; String anotherStr = " abcdefghijklmnopqrstuvwxyz " ; int k = 2 ; Console . WriteLine ( countSubStrings ( str , anotherStr , k ) ) ; } }

Index/key variables: MAX_CHAR, i, j
Accumulator variables: i
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countPairs ( string [ ] bracks , int num ) { Dictionary < int , int > open = new Dictionary < int , int > ( ) ; Dictionary < int , int > close = new Dictionary < int , int > ( ) ; int cnt = 0 ; for ( int i = 0 ; i < num ; i ++ ) { string s = bracks [ i ] ; int l = s . Length ; int op = 0 , cl = 0 ; for ( int j = 0 ; j < l ; j ++ ) { if ( s [ j ] == ' ( ' ) op ++ ; else { if ( op != 0 ) op -- ; else cl ++ ; } } if ( op != 0 && cl == 0 ) { if ( open . ContainsKey ( op ) ) { open [ op ] ++ ; } else { open [ op ] = 1 ; } } if ( cl != 0 && op == 0 ) { if ( close . ContainsKey ( cl ) ) { close [ cl ] ++ ; } else { close [ cl ] = 1 ; } } if ( op == 0 && cl == 0 ) cnt ++ ; } cnt /= 2 ; foreach ( KeyValuePair < int , int > it in open ) { cnt += Math . Min ( it . Value , close [ it . Value ] ) ; } return cnt ; } public static void Main ( string [ ] args ) { string [ ] bracks = { " ) ( ) ) " , " ) " , " ( ( " , " ( ( " , " ( " , " ) " , " ) " } ; int num = bracks . Length ; Console . Write ( countPairs ( bracks , num ) ) ; } }

Index/key variables: cl, i, j, op
Accumulator variables: cl, cnt, i, j, op
Iterator variables: i, it, j
Class/struct names: GFG
C# program:
using System ; class GFG { static string removeChars ( string s ) { string modifiedStr = " " ; modifiedStr += s [ 0 ] ; for ( int i = 1 ; i < s . Length ; i ++ ) { if ( char . IsUpper ( s [ i ] ) && char . IsLower ( s [ i - 1 ] ) || char . IsLower ( s [ i ] ) && char . IsUpper ( s [ i - 1 ] ) ) modifiedStr += s [ i ] ; } return modifiedStr ; } public static void Main ( ) { string s = " GeeksForGeeks " ; Console . Write ( removeChars ( s ) ) ; } }

Index/key variables: i
Accumulator variables: i, modifiedStr
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int pangramCost ( int [ ] arr , string str ) { int cost = 0 ; bool [ ] occurred = new bool [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) occurred [ i ] = false ; for ( int i = 0 ; i < str . Length ; i ++ ) occurred [ str [ i ] - ' a ' ] = true ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( occurred [ i ] == false ) cost += arr [ i ] ; } return cost ; } public static void Main ( string [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 } ; string str = " abcdefghijklmopqrstuvwz " ; Console . WriteLine ( pangramCost ( arr , str ) ) ; } }

Index/key variables: i
Accumulator variables: cost, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String output = " " ; static void pairStar ( String input , int i ) { output = output + input [ i ] ; if ( i == input . Length - 1 ) return ; if ( input [ i ] == input [ i + 1 ] ) output = output + ' * ' ; pairStar ( input , i + 1 ) ; } public static void Main ( String [ ] args ) { String input = " geeks " ; pairStar ( input , 0 ) ; Console . WriteLine ( output ) ; } }

Index/key variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int maxOperations ( string str ) { int i , g , gk , gks ; i = g = gk = gks = 0 ; for ( i = 0 ; i < str . Length ; i ++ ) { if ( str [ i ] == ' g ' ) { g ++ ; } else if ( str [ i ] == ' k ' ) { if ( g > 0 ) { g -- ; gk ++ ; } } else if ( str [ i ] == ' s ' ) { if ( gk > 0 ) { gk -- ; gks ++ ; } } } return gks ; } public static void Main ( ) { string a = " ggkssk " ; Console . WriteLine ( maxOperations ( a ) ) ; } }

Index/key variables: i
Accumulator variables: g, gk, gks, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int [ ] getFrequencies ( String str ) { int [ ] freq = new int [ 26 ] ; for ( int i = 0 ; i < str . Length ; i ++ ) { freq [ str [ i ] - ' a ' ] ++ ; } return freq ; } static int countMinParts ( String str ) { int n = str . Length ; int [ ] freq = getFrequencies ( str ) ; List < int > oddFreq = new List < int > ( ) ; List < int > evenFreq = new List < int > ( ) ; int i , sumEven = 0 ; for ( i = 0 ; i < 26 ; i ++ ) { if ( freq [ i ] == 0 ) continue ; if ( freq [ i ] % 2 == 0 ) evenFreq . Add ( freq [ i ] ) ; else oddFreq . Add ( freq [ i ] ) ; } for ( i = 0 ; i < evenFreq . Count ; i ++ ) { sumEven += evenFreq [ i ] ; } if ( oddFreq . Count == 0 ) return 1 ; if ( sumEven == 0 ) { if ( oddFreq . Count == 1 ) return 1 ; return 0 ; } i = 0 ; while ( i < oddFreq . Count ) { if ( ( sumEven / 2 ) % oddFreq . Count == 0 ) return oddFreq . Count ; if ( oddFreq [ i ] == 1 ) { i ++ ; continue ; } sumEven += 2 ; oddFreq . Insert ( i , oddFreq [ i ] - 2 ) ; } return n ; } public static void Main ( String [ ] args ) { String s = " noonpeep " ; Console . WriteLine ( countMinParts ( s ) ) ; } }

Index/key variables: i
Accumulator variables: i, sumEven
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printPattern ( char [ ] s , int n ) { Console . WriteLine ( s ) ; int i = 0 , j = n - 1 ; while ( i < j ) { char c = s [ i ] ; s [ i ] = s [ j ] ; s [ j ] = c ; i ++ ; j -- ; } i = 0 ; j = n - 1 ; while ( j - i > 1 ) { s [ i ] = s [ j ] = ' * ' ; Console . WriteLine ( s ) ; i ++ ; j -- ; } } public static void Main ( String [ ] args ) { char [ ] s = " geeks " . ToCharArray ( ) ; int n = s . Length ; printPattern ( s , n ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static Boolean prime ( int n ) { if ( n <= 1 ) { return false ; } if ( n <= 3 ) { return true ; } if ( n % 2 == 0 n % 3 == 0 ) { return false ; } for ( int i = 5 ; i * i <= n ; i = i + 6 ) { if ( n % i == 0 || n % ( i + 2 ) == 0 ) { return false ; } } return true ; } static Boolean isVowel ( char c ) { c = char . ToLower ( c ) ; if ( c == ' a ' c == ' e ' c == ' i ' c == ' o ' c == ' u ' ) { return true ; } return false ; } static Boolean isValidString ( String word ) { int cnt = 0 ; for ( int i = 0 ; i < word . Length ; i ++ ) { if ( isVowel ( word [ i ] ) ) { cnt ++ ; } } if ( prime ( cnt ) ) { return true ; } else { return false ; } } public static void Main ( String [ ] args ) { String s = " geeksforgeeks " ; if ( isValidString ( s ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printExpansion ( String str ) { String suff = " " ; for ( int i = str . Length - 1 ; i >= 0 ; i -- ) { suff = suff + str [ i ] ; Console . Write ( suff ) ; } } public static void Main ( String [ ] args ) { String str = " geeks " ; printExpansion ( str ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static char logicalExpressionEvaluation ( String str ) { Stack < char > arr = new Stack < char > ( ) ; for ( int i = str . Length - 1 ; i >= 0 ; i -- ) { if ( str [ i ] == ' [ ' ) { List < char > s = new List < char > ( ) ; while ( arr . Peek ( ) != ' ] ' ) { s . Add ( arr . Peek ( ) ) ; arr . Pop ( ) ; } arr . Pop ( ) ; if ( s . Count == 3 ) { arr . Push ( s [ 2 ] == '1' ? '0' : '1' ) ; } else if ( s . Count == 5 ) { int a = s [ 0 ] - 48 , b = s [ 4 ] - 48 , c ; if ( s [ 2 ] == ' & ' ) { c = a & b ; } else { c = a | b ; } arr . Push ( ( char ) ( c + 48 ) ) ; } } else { arr . Push ( str [ i ] ) ; } } return arr . Peek ( ) ; } public static void Main ( String [ ] args ) { String str = " [ [0 , & ,1 ] , | , [ ! ,1 ] ] " ; Console . WriteLine ( logicalExpressionEvaluation ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG