dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static void RemoveHTMLTags ( String str ) { System . Text . RegularExpressions . Regex rx = new System . Text . RegularExpressions . Regex ( " < [ ^ > ] * > " ) ; str = rx . Replace ( str , " " ) ; Console . WriteLine ( str ) ; } public static void Main ( String [ ] args ) { String str ; str = " < div > < b > Geeks ▁ for ▁ Geeks < / b > < / div > " ; RemoveHTMLTags ( str ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { class TreeNode { public TreeNode parent = null ; public ArrayList children = new ArrayList ( ) ; public void addChild ( TreeNode node ) { children . Add ( node ) ; } public void setParent ( TreeNode node ) { parent = node ; } public TreeNode getParent ( ) { return parent ; } public int computeScore ( ) { if ( children . Count == 0 ) return 1 ; int res = 0 ; foreach ( TreeNode curr in children ) res += curr . computeScore ( ) ; if ( parent == null ) return res ; else return 2 * res ; } } ; static TreeNode computeTree ( string s ) { TreeNode current = new TreeNode ( ) ; TreeNode root = current ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] == ' ( ' ) { TreeNode child = new TreeNode ( ) ; child . setParent ( current ) ; current . addChild ( child ) ; current = child ; } else { current = current . getParent ( ) ; } } return root ; } public static void Main ( ) { string s = " ( ( ) ( ( ) ) ) " ; TreeNode root = computeTree ( s ) ; Console . Write ( root . computeScore ( ) ) ; } }

Index/key variables: i
Accumulator variables: i, res
Iterator variables: curr, i
Class/struct names: GFG, TreeNode
C# program:
using System ; class GFG { static void rec ( char [ ] a , int i ) { if ( i == 0 ) { Console . WriteLine ( a ) ; return ; } if ( a [ i ] == ' x ' ) { int j = i ; while ( a [ j ] != ' \0' && a [ j + 1 ] != ' \0' ) { char temp = a [ j ] ; a [ j ] = a [ j + 1 ] ; a [ j + 1 ] = temp ; j ++ ; } } rec ( a , i - 1 ) ; } static void Main ( ) { char [ ] a = { ' g ' , ' e ' , ' e ' , ' k ' , ' x ' , ' s ' , ' x ' , ' x ' , ' k ' , ' s ' , ' \0' } ; int n = 10 ; rec ( a , n - 1 ) ; } }

Index/key variables: i, j
Accumulator variables: j
Class/struct names: GFG
C# program:
using System ; class GFG { public static String largestchar ( String str ) { bool [ ] uppercase = new bool [ 26 ] ; bool [ ] lowercase = new bool [ 26 ] ; char [ ] arr = str . ToCharArray ( ) ; foreach ( char c in arr ) { if ( char . IsLower ( c ) ) lowercase = true ; if ( char . IsUpper ( c ) ) uppercase = true ; } for ( int i = 25 ; i >= 0 ; i -- ) { if ( uppercase [ i ] && lowercase [ i ] ) return ( char ) ( i + ' A ' ) + " " ; } return " - 1" ; } public static void Main ( String [ ] args ) { String str = " admeDCAB " ; Console . WriteLine ( largestchar ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: c, i
Boolean variables: lowercase, uppercase
Class/struct names: GFG
C# program:
using System ; class GFG { static String generateString ( int N , int M , int K ) { String s = " " ; int cnt1 = 0 ; int cnt2 = 0 ; for ( int i = 0 ; i < N ; i ++ ) { cnt1 ++ ; cnt2 ++ ; if ( cnt1 <= M ) { if ( cnt2 <= K ) { s = s + ( char ) ( 96 + cnt1 ) ; } else { s = s + ' a ' ; } } else { cnt1 = 1 ; cnt2 = 1 ; s = s + ' a ' ; } } return s ; } public static void Main ( String [ ] args ) { int N = 7 , M = 5 , K = 3 ; Console . WriteLine ( generateString ( N , M , K ) ) ; } }

Accumulator variables: cnt1, cnt2, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void finalString ( String str ) { int x = 0 , y = 0 ; int left ; int n = str . Length ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] == '1' ) x ++ ; else y ++ ; } if ( x > y ) left = 1 ; else left = 0 ; int length = n - 2 * Math . Min ( x , y ) ; for ( int i = 0 ; i < length ; i ++ ) { Console . Write ( left ) ; } } public static void Main ( String [ ] args ) { String str = "010110100100000" ; finalString ( str ) ; } }

Index/key variables: i
Accumulator variables: i, x, y
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void printPalindrome ( List < String > left , String mid , List < String > right ) { foreach ( String x in left ) Console . Write ( x ) ; Console . Write ( mid ) ; right . Reverse ( ) ; foreach ( String x in right ) Console . Write ( x ) ; Console . WriteLine ( ) ; } static void findPalindrome ( List < String > S , int N , int M ) { HashSet < String > dict = new HashSet < String > ( ) ; for ( int i = 0 ; i < M ; i ++ ) { dict . Add ( S [ i ] ) ; } List < String > left = new List < String > ( ) , right = new List < String > ( ) ; String mid = " " ; for ( int i = 0 ; i < N ; i ++ ) { String t = S [ i ] ; t = reverse ( t ) ; if ( t == S [ i ] ) mid = t ; else if ( dict . Contains ( t ) ) { left . Add ( S [ i ] ) ; right . Add ( t ) ; dict . Remove ( S [ i ] ) ; dict . Remove ( t ) ; } } printPalindrome ( left , mid , right ) ; } static String reverse ( String input ) { char [ ] a = input . ToCharArray ( ) ; int l , r = a . Length - 1 ; for ( l = 0 ; l < r ; l ++ , r -- ) { char temp = a [ l ] ; a [ l ] = a [ r ] ; a [ r ] = temp ; } return String . Join ( " " , a ) ; } public static void Main ( String [ ] args ) { String [ ] arr = { " tab " , " one " , " bat " } ; List < String > S = new List < String > ( arr ) ; int M = 3 ; int N = S . Count ; findPalindrome ( S , N , M ) ; } }

Index/key variables: i, l, r
Accumulator variables: i, l, r
Iterator variables: i, l, x
Class/struct names: GFG
C# program:
using System ; class GFG { static string swap ( string str , int i , int j ) { char [ ] tempArr = str . ToCharArray ( ) ; char temp = tempArr [ i ] ; tempArr [ i ] = tempArr [ j ] ; tempArr [ j ] = temp ; return new string ( tempArr ) ; } static bool IsLexicographicallySmaller ( string A , string B ) { if ( A . CompareTo ( B ) < 0 ) { return true ; } string temp = A ; char [ ] p = temp . ToCharArray ( ) ; Array . Sort ( p ) ; temp = new string ( p ) ; int index = - 1 ; for ( int i = 0 ; i < A . Length ; i ++ ) { if ( A [ i ] != temp [ i ] ) { index = i ; break ; } } if ( index == - 1 ) { return false ; } int j = 0 ; for ( int i = 0 ; i < A . Length ; i ++ ) { if ( A [ i ] == temp [ index ] ) j = i ; } A = swap ( A , index , j ) ; if ( A . CompareTo ( B ) < 0 ) { return true ; } else { return false ; } } public static void Main ( string [ ] args ) { string A = " AGAIN " ; string B = " ACTION " ; if ( IsLexicographicallySmaller ( A , B ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

Index/key variables: i, index, j
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int max ( int x , int y ) { return ( x > y ) ? x : y ; } static int longestPalindromic ( String str , int i , int j , int count ) { if ( i > j ) return count ; if ( i == j ) return ( count + 1 ) ; if ( str [ i ] == str [ j ] ) { count = longestPalindromic ( str , i + 1 , j - 1 , count + 2 ) ; return max ( count , max ( longestPalindromic ( str , i + 1 , j , 0 ) , longestPalindromic ( str , i , j - 1 , 0 ) ) ) ; } return Math . Max ( longestPalindromic ( str , i + 1 , j , 0 ) , longestPalindromic ( str , i , j - 1 , 0 ) ) ; } static int longest_palindromic_substr ( String str ) { return longestPalindromic ( str , 0 , str . Length - 1 , 0 ) ; } public static void Main ( String [ ] args ) { String str = " aaaabbaa " ; Console . Write ( longest_palindromic_substr ( str ) ) ; } }

Index/key variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; using System . Linq ; class GFG { static void MaxPrefix ( string s ) { Dictionary < char , int > Dict = new Dictionary < char , int > ( ) ; foreach ( char i in s ) { if ( Dict . ContainsKey ( i ) ) { Dict [ i ] ++ ; } else { Dict [ i ] = 1 ; } } int minfrequency = Int32 . MaxValue ; foreach ( int x in Dict . Values . ToList ( ) ) { minfrequency = Math . Min ( minfrequency , x ) ; } int countminFrequency = 0 ; foreach ( char x in Dict . Keys . ToList ( ) ) { if ( Dict [ x ] == minfrequency ) countminFrequency += 1 ; } Dictionary < char , int > mapper = new Dictionary < char , int > ( ) ; int indi = 0 ; foreach ( char i in s ) { if ( mapper . ContainsKey ( i ) ) { mapper [ i ] ++ ; } else { mapper [ i ] = 1 ; } if ( mapper [ i ] > countminFrequency ) break ; indi += 1 ; } Console . Write ( s . Substring ( 0 , indi ) ) ; } public static void Main ( string [ ] args ) { string str = " aabcdaab " ; MaxPrefix ( str ) ; } }

Index/key variables: i, x
Accumulator variables: countminFrequency, indi
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; class GFG { static int countSubString ( char [ ] S , char [ ] L , int n ) { int [ ] freq = new int [ 26 ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { freq [ ( int ) ( L [ i ] - ' a ' ) ] = 1 ; } int count = 0 ; foreach ( int x in S ) { if ( freq [ ( int ) ( x - ' a ' ) ] > 0 ) { ans += ( count * count + count ) / 2 ; count = 0 ; } else count ++ ; } ans += ( count * count + count ) / 2 ; return ans ; } public static void Main ( ) { string S = " abcpxyz " ; char [ ] L = { ' a ' , ' p ' , ' q ' } ; int n = L . Length ; Console . WriteLine ( countSubString ( S . ToCharArray ( ) , L , n ) ) ; } }

Index/key variables: i
Accumulator variables: ans, count, i
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; class GFG { static int checkIfStartsWithVowels ( char [ ] str ) { if ( ! ( str [ 0 ] == ' A ' str [ 0 ] == ' a ' str [ 0 ] == ' E ' str [ 0 ] == ' e ' str [ 0 ] == ' I ' str [ 0 ] == ' i ' str [ 0 ] == ' O ' str [ 0 ] == ' o ' str [ 0 ] == ' U ' str [ 0 ] == ' u ' ) ) return 1 ; else return 0 ; } static void check ( String str ) { if ( checkIfStartsWithVowels ( str . ToCharArray ( ) ) == 1 ) Console . Write ( " Not ▁ Accepted STRNEWLINE " ) ; else Console . Write ( " Accepted STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { String str = " animal " ; check ( str ) ; str = " zebra " ; check ( str ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findNthOccur ( String str , char ch , int N ) { int occur = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( str [ i ] == ch ) { occur += 1 ; } if ( occur == N ) return i ; } return - 1 ; } public static void Main ( String [ ] args ) { String str = " geeks " ; char ch = ' e ' ; int N = 2 ; Console . Write ( findNthOccur ( str , ch , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, occur
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int solve ( string X , string Y , int N , int K ) { int [ ] count = new int [ N + 1 ] ; int sol = 0 ; count [ 0 ] = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { count [ i ] = count [ i - 1 ] + Math . Abs ( X [ i - 1 ] - Y [ i - 1 ] ) ; } int j = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { while ( ( count [ i ] - count [ j ] ) > K ) { j ++ ; } sol = Math . Max ( sol , i - j ) ; } return sol ; } public static void Main ( ) { int N = 4 ; string X = " abcd " , Y = " bcde " ; int K = 3 ; Console . WriteLine ( solve ( X , Y , N , K ) + " STRNEWLINE " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double jaro_distance ( string s1 , string s2 ) { if ( s1 == s2 ) return 1.0 ; int len1 = s1 . Length , len2 = s2 . Length ; if ( len1 == 0 len2 == 0 ) return 0.0 ; int max_dist = ( int ) Math . Floor ( ( double ) Math . Max ( len1 , len2 ) / 2 ) - 1 ; int match = 0 ; int [ ] hash_s1 = new int [ s1 . Length ] ; int [ ] hash_s2 = new int [ s2 . Length ] ; for ( int i = 0 ; i < len1 ; i ++ ) { for ( int j = Math . Max ( 0 , i - max_dist ) ; j < Math . Min ( len2 , i + max_dist + 1 ) ; j ++ ) if ( s1 [ i ] == s2 [ j ] && hash_s2 [ j ] == 0 ) { hash_s1 [ i ] = 1 ; hash_s2 [ j ] = 1 ; match ++ ; break ; } } if ( match == 0 ) return 0.0 ; double t = 0 ; int point = 0 ; for ( int i = 0 ; i < len1 ; i ++ ) if ( hash_s1 [ i ] == 1 ) { while ( hash_s2 [ point ] == 0 ) point ++ ; if ( s1 [ i ] != s2 [ point ++ ] ) t ++ ; } t /= 2 ; return ( ( ( double ) match ) / ( ( double ) len1 ) + ( ( double ) match ) / ( ( double ) len2 ) + ( ( double ) match - t ) / ( ( double ) match ) ) / 3.0 ; } static double jaro_Winkler ( string s1 , string s2 ) { double jaro_dist = jaro_distance ( s1 , s2 ) ; if ( jaro_dist > 0.7 ) { int prefix = 0 ; for ( int i = 0 ; i < Math . Min ( s1 . Length , s2 . Length ) ; i ++ ) { if ( s1 [ i ] == s2 [ i ] ) prefix ++ ; else break ; } prefix = Math . Min ( 4 , prefix ) ; jaro_dist += 0.1 * prefix * ( 1 - jaro_dist ) ; } return jaro_dist ; } public static void Main ( ) { string s1 = " TRATE " , s2 = " TRACE " ; Console . WriteLine ( " Jaro - Winkler ▁ Similarity ▁ = " + jaro_Winkler ( s1 , s2 ) ) ; } }

Index/key variables: i, j, point
Accumulator variables: i, j, jaro_dist, match, point, prefix, t
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isWordPresent ( String sentence , String word ) { String [ ] s = sentence . Split ( ' ▁ ' ) ; foreach ( String temp in s ) { if ( temp . CompareTo ( word ) == 0 ) { return true ; } } return false ; } public static void Main ( String [ ] args ) { String s = " Geeks ▁ for ▁ Geeks " ; String word = " Geeks " ; if ( isWordPresent ( s , word ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Iterator variables: temp
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isWordPresent ( String sentence , String word ) { word = transform ( word ) ; sentence = transform ( sentence ) ; String [ ] s = sentence . Split ( ' ▁ ' ) ; foreach ( String temp in s ) { if ( temp . CompareTo ( word ) == 0 ) { return true ; } } return false ; } static String transform ( String word ) { return word . ToUpper ( ) ; } public static void Main ( String [ ] args ) { String s = " Geeks ▁ for ▁ Geeks " ; String word = " geeks " ; if ( isWordPresent ( s , word ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Iterator variables: temp
Class/struct names: GFG
C# program:
using System ; class GFG { static int countChars ( string str , int n ) { int i = 0 , cnt = 0 ; while ( i < n ) { if ( str [ i ] == '0' ) i += 1 ; else i += 2 ; cnt += 1 ; } return cnt ; } public static void Main ( ) { string str = "11010" ; int n = str . Length ; Console . WriteLine ( countChars ( str , n ) ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 26 ; static void compressString ( string s , int n ) { int [ ] freq = new int [ MAX ] ; for ( int i = 0 ; i < n ; i ++ ) { freq [ s [ i ] - ' a ' ] ++ ; } for ( int i = 0 ; i < MAX ; i ++ ) { if ( freq [ i ] == 0 ) continue ; Console . Write ( ( char ) ( i + ' a ' ) + " " + freq [ i ] ) ; } } public static void Main ( ) { string s = " geeksforgeeks " ; int n = s . Length ; compressString ( s , n ) ; } }

Index/key variables: MAX, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void decBinary ( int [ ] arr , int n ) { int k = ( int ) ( Math . Log ( n ) / Math . Log ( 2 ) ) ; while ( n > 0 ) { arr [ k -- ] = n % 2 ; n /= 2 ; } } static int binaryDec ( int [ ] arr , int n ) { int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) ans += arr [ i ] << ( n - i - 1 ) ; return ans ; } static int concat ( int m , int n ) { int k = ( int ) ( Math . Log ( m ) / Math . Log ( 2 ) ) + 1 ; int l = ( int ) ( Math . Log ( n ) / Math . Log ( 2 ) ) + 1 ; int [ ] a = new int [ k ] ; int [ ] b = new int [ l ] ; int [ ] c = new int [ k + l ] ; decBinary ( a , m ) ; decBinary ( b , n ) ; int iN = 0 ; for ( int i = 0 ; i < k ; i ++ ) c [ iN ++ ] = a [ i ] ; for ( int i = 0 ; i < l ; i ++ ) c [ iN ++ ] = b [ i ] ; return ( binaryDec ( c , k + l ) ) ; } public static void Main ( String [ ] args ) { int m = 4 , n = 5 ; Console . WriteLine ( concat ( m , n ) ) ; } }

Index/key variables: i, k, l
Accumulator variables: ans, i, iN, k, n
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int getBinaryLength ( int n ) { int length = 0 ; while ( n > 0 ) { length += 1 ; n /= 2 ; } return length ; } static int concat ( int m , int n ) { int length = getBinaryLength ( n ) ; return ( m << length ) + n ; } static void Main ( ) { int m = 4 , n = 5 ; Console . WriteLine ( concat ( m , n ) ) ; } }

Accumulator variables: length, n
Class/struct names: GFG
C# program:
using System ; class GFG { static String addZeros ( String str , int n ) { for ( int i = 0 ; i < n ; i ++ ) { str = "0" + str ; } return str ; } static String getXOR ( String a , String b ) { int aLen = a . Length ; int bLen = b . Length ; if ( aLen > bLen ) { a = addZeros ( b , aLen - bLen ) ; } else if ( bLen > aLen ) { a = addZeros ( a , bLen - aLen ) ; } int len = Math . Max ( aLen , bLen ) ; String res = " " ; for ( int i = 0 ; i < len ; i ++ ) { if ( a [ i ] == b [ i ] ) res += "0" ; else res += "1" ; } return res ; } public static void Main ( String [ ] args ) { String a = "11001" , b = "111111" ; Console . WriteLine ( getXOR ( a , b ) ) ; } }

Index/key variables: i
Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class Node { public int [ ] soln ; public int level ; public List < Node > child ; public Node parent ; public Node ( Node parent , int level , int N ) { this . parent = parent ; this . level = level ; this . soln = new int [ N ] ; } } class GFG { static int N ; public static Queue < Node > Q ; public static void generate ( Node n ) { if ( n . level == N ) { for ( int i = 0 ; i <= N - 1 ; i ++ ) { Console . Write ( n . soln [ i ] ) ; } Console . WriteLine ( ) ; } else { n . child = new List < Node > ( ) ; int l = n . level ; for ( int i = 0 ; i <= 1 ; i ++ ) { Node x = new Node ( n , l + 1 , N ) ; for ( int k = 0 ; k < l ; k ++ ) { x . soln [ k ] = n . soln [ k ] ; } x . soln [ l ] = i ; n . child . Add ( x ) ; Q . Enqueue ( x ) ; } } } public static void Main ( String [ ] args ) { N = 3 ; Node root = new Node ( null , 0 , N ) ; Q = new Queue < Node > ( ) ; Q . Enqueue ( root ) ; while ( Q . Count != 0 ) { Node E = Q . Dequeue ( ) ; generate ( E ) ; } } }

Index/key variables: N, i, k, l
Accumulator variables: i, k
Iterator variables: i, k
Class/struct names: GFG, Node
C# program:
using System ; class GFG { readonly static int MAX = 26 ; static int minOperation ( String str , int len ) { int [ ] first = new int [ MAX ] ; int [ ] last = new int [ MAX ] ; for ( int i = 0 ; i < MAX ; i ++ ) { first [ i ] = - 1 ; last [ i ] = - 1 ; } for ( int i = 0 ; i < len ; i ++ ) { int index = ( str [ i ] - ' a ' ) ; if ( first [ index ] == - 1 ) first [ index ] = i ; last [ index ] = i ; } int minOp = - 1 ; for ( int i = 0 ; i < MAX ; i ++ ) { if ( first [ i ] == - 1 first [ i ] == last [ i ] ) continue ; int cnt = len - ( last [ i ] - first [ i ] + 1 ) ; if ( minOp == - 1 cnt < minOp ) minOp = cnt ; } return minOp ; } public static void Main ( String [ ] args ) { String str = " abcda " ; int len = str . Length ; Console . WriteLine ( minOperation ( str , len ) ) ; } }

Index/key variables: MAX, i, index
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int N = 2 ; static Boolean isVowel ( char ch ) { return ( ch == ' a ' ch == ' e ' ch == ' i ' ch == ' o ' ch == ' u ' ) ; } static int countVowels ( String str , int l , int r ) { int cnt = 0 ; for ( int i = l ; i <= r ; i ++ ) { if ( isVowel ( str [ i ] ) ) cnt ++ ; } return cnt ; } static void performQueries ( String str , int [ , ] queries , int q ) { for ( int i = 0 ; i < q ; i ++ ) { Console . WriteLine ( countVowels ( str , queries [ i , 0 ] , queries [ i , 1 ] ) ) ; } } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; int [ , ] queries = { { 1 , 3 } , { 2 , 4 } , { 1 , 9 } } ; int q = queries . GetLength ( 0 ) ; performQueries ( str , queries , q ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { class node { public char data ; public node next ; } ; static node add ( char data ) { node newnode = new node ( ) ; newnode . data = data ; newnode . next = null ; return newnode ; } static node string_to_SLL ( String text , node head ) { head = add ( text [ 0 ] ) ; node curr = head ; for ( int i = 1 ; i < text . Length ; i ++ ) { curr . next = add ( text [ i ] ) ; curr = curr . next ; } return head ; } static void print ( node head ) { node curr = head ; while ( curr != null ) { Console . Write ( curr . data + " ▁ - > ▁ " ) ; curr = curr . next ; } } public static void Main ( String [ ] args ) { String text = " GEEKS " ; node head = null ; head = string_to_SLL ( text , head ) ; print ( head ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, node
C# program:
using System ; using System . Collections . Generic ; class GFG { static int minLength ( String str , int len ) { Stack < char > s = new Stack < char > ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( s . Count == 0 ) { s . Push ( str [ i ] ) ; } else { char c = s . Peek ( ) ; if ( c != str [ i ] && char . ToUpper ( c ) == char . ToUpper ( ( str [ i ] ) ) ) { s . Pop ( ) ; } else { s . Push ( str [ i ] ) ; } } } return s . Count ; } public static void Main ( String [ ] args ) { String str = " ASbBsd " ; int len = str . Length ; Console . WriteLine ( minLength ( str , len ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 26 ; static Boolean canBeMadeEqual ( String str1 , String str2 ) { int len1 = str1 . Length ; int len2 = str2 . Length ; if ( len1 == len2 ) { int [ ] freq = new int [ MAX ] ; for ( int i = 0 ; i < len1 ; i ++ ) { freq [ str1 [ i ] - ' a ' ] ++ ; } for ( int i = 0 ; i < len2 ; i ++ ) { if ( freq [ str2 [ i ] - ' a ' ] > 0 ) return true ; } } return false ; } public static void Main ( String [ ] args ) { String str1 = " abc " , str2 = " defa " ; if ( canBeMadeEqual ( str1 , str2 ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: MAX, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int getCount ( string str , int n ) { int cnt = 0 ; int i = 0 ; while ( i < n - 2 ) { if ( str [ i ] == str [ i + 1 ] && str [ i ] == str [ i + 2 ] ) { cnt ++ ; i = i + 2 ; } else { i ++ ; } } return cnt ; } static public void Main ( ) { string str = " aabbbcc " ; int n = str . Length ; Console . WriteLine ( getCount ( str , n ) ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int fact ( int n ) { int fact = 1 ; for ( int i = 1 ; i <= n ; i ++ ) fact *= i ; return fact ; } static int countStrings ( String str , int n ) { HashSet < char > distinct_char = new HashSet < char > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { distinct_char . Add ( str [ i ] ) ; } return fact ( distinct_char . Count ) ; } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; int n = str . Length ; Console . WriteLine ( countStrings ( str , n ) ) ; } }

Index/key variables: i
Accumulator variables: fact, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static char getChar ( String str ) { int sum = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { sum += ( str [ i ] - ' a ' + 1 ) ; } if ( sum % 26 == 0 ) return ' z ' ; else { sum = sum % 26 ; return ( char ) ( ' a ' + sum - 1 ) ; } } public static void Main ( String [ ] args ) { String str = " gfg " ; Console . WriteLine ( getChar ( str ) ) ; } }

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