dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static bool isConsonant ( char ch ) { ch = Char . ToUpper ( ch ) ; return ! ( ch == ' A ' ch == ' E ' ch == ' I ' ch == ' O ' ch == ' U ' ) && ch >= 65 && ch <= 90 ; } static int totalConsonants ( String str ) { int count = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) if ( isConsonant ( str [ i ] ) ) ++ count ; return count ; } public static void Main ( ) { String str = " abc ▁ de " ; Console . Write ( totalConsonants ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static Boolean isConsonant ( char ch ) { ch = char . ToUpper ( ch ) ; return ( ch == ' A ' ch == ' E ' ch == ' I ' ch == ' O ' ch == ' U ' ) == false && ch >= 65 && ch <= 90 ; } static int totalConsonants ( String str , int n ) { if ( n == 1 ) { if ( isConsonant ( str [ 0 ] ) ) return 1 ; else return 0 ; } if ( isConsonant ( str [ n - 1 ] ) ) return totalConsonants ( str , n - 1 ) + 1 ; else return totalConsonants ( str , n - 1 ) ; } public static void Main ( String [ ] args ) { String str = " abc ▁ de " ; Console . WriteLine ( totalConsonants ( str , str . Length ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GfG { public static long reverseBits ( long n ) { long rev = 0 ; while ( n > 0 ) { rev <<= 1 ; if ( ( n & 1 ) == 1 ) rev ^= 1 ; n >>= 1 ; } return rev ; } public static bool isPalindrome ( long n ) { long rev = reverseBits ( n ) ; return ( n == rev ) ; } public static void Main ( ) { long n = 9 ; if ( isPalindrome ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: rev
Class/struct names: GfG
C# program:
using System ; class GFG { static readonly int MAX = 26 ; static void Swap ( string s , string t , int n ) { int [ , ] dp = new int [ MAX , MAX ] ; for ( int i = 0 ; i < MAX ; i ++ ) { for ( int j = 0 ; j < MAX ; j ++ ) { dp [ i , j ] = - 1 ; } } 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 ) { Console . WriteLine ( i + 1 + " ▁ " + ( dp [ a , b ] + 1 ) ) ; return ; } dp [ b , a ] = i ; } int [ ] A = new int [ MAX ] ; int [ ] B = new int [ MAX ] ; for ( int i = 0 ; i < MAX ; i ++ ) { A [ i ] = - 1 ; B [ i ] = - 1 ; } 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 ) { Console . WriteLine ( i + 1 + " ▁ " + ( A [ b ] + 1 ) ) ; return ; } if ( B [ a ] != - 1 ) { Console . WriteLine ( i + 1 + " ▁ " + ( B [ a ] + 1 ) ) ; return ; } A [ a ] = i ; B [ b ] = i ; } Console . WriteLine ( - 1 ) ; } public static int Main ( ) { string S = " permanent " ; string T = " pergament " ; int n = S . Length ; if ( S == " " T == " " ) Console . WriteLine ( " Required ▁ string ▁ is ▁ empty . " ) ; else Swap ( S , T , n ) ; return 0 ; } }

Index/key variables: MAX, a, b, i
Accumulator variables: i, j, tot
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static readonly int MAX = 26 ; static void printAnagramAndChanges ( char [ ] X , char [ ] Y ) { int [ ] countx = new int [ MAX ] ; int [ ] county = new int [ MAX ] ; int [ ] ctrx = new int [ MAX ] ; int [ ] ctry = new int [ MAX ] ; 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 += Math . 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 ] = ( char ) ( ' A ' + j ) ; } else { countx [ X [ i ] - ' A ' ] -- ; } } Console . WriteLine ( " Anagram ▁ : ▁ " + String . Join ( " " , X ) ) ; Console . WriteLine ( " Number ▁ of ▁ changes ▁ made ▁ : ▁ " + change / 2 ) ; } public static void Main ( String [ ] args ) { String x = " CDBABC " , y = " ADCABD " ; printAnagramAndChanges ( x . ToCharArray ( ) , y . ToCharArray ( ) ) ; } }

Index/key variables: MAX, i, j
Accumulator variables: change, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 256 ; static int countPairs ( string s ) { int [ ] cnt = new int [ MAX ] ; 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 ; } public static void Main ( ) { string s = " geeksforgeeks " ; Console . WriteLine ( countPairs ( s ) ) ; } }

Index/key variables: MAX, i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static String lexNext ( String str , int n ) { char [ ] s = str . ToCharArray ( ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( s [ i ] != ' z ' ) { s [ i ] ++ ; return new String ( s ) ; } s [ i ] = ' a ' ; } return null ; } static public void Main ( ) { String S = " abcdeg " , T = " abcfgh " ; int n = S . Length ; String res = lexNext ( S , n ) ; if ( res != T ) { Console . Write ( res ) ; } else { Console . Write ( " - 1" ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class Geek { static void solve ( int n , int t , char [ ] 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 ++ ; } Console . Write ( s ) ; } public static void Main ( String [ ] args ) { int n = 6 , t = 2 ; String s = " BBGBBG " ; char [ ] str = s . ToCharArray ( ) ; solve ( n , t , str ) ; } }

Index/key variables: j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: Geek
C# program:
using System ; class GFG { static int calSumUtil ( int [ ] a , int [ ] b , int n , int m ) { int [ ] sum = new int [ 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 == 1 ) ans = 10 ; for ( i = 0 ; i <= n - 1 ; i ++ ) { ans += sum [ i ] ; ans *= 10 ; } return ans / 10 ; } static 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 ) ; } public static void Main ( ) { int [ ] a = { 9 , 3 , 9 } ; int [ ] b = { 6 , 1 } ; int n = a . Length ; int m = b . Length ; Console . WriteLine ( calSum ( a , b , n , m ) ) ; } }

Index/key variables: i, j, k, n
Accumulator variables: ans, i, j, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int SIZE = 26 ; static int longCommomAnagramSubseq ( string str1 , string str2 , int n1 , int n2 ) { int [ ] freq1 = new int [ SIZE ] ; int [ ] freq2 = new int [ SIZE ] ; for ( int i = 0 ; i < SIZE ; i ++ ) { freq1 [ i ] = 0 ; freq2 [ i ] = 0 ; } 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 += Math . Min ( freq1 [ i ] , freq2 [ i ] ) ; return len ; } static void Main ( ) { string str1 = " abdacp " ; string str2 = " ckamb " ; int n1 = str1 . Length ; int n2 = str2 . Length ; Console . Write ( " Length ▁ = ▁ " + longCommomAnagramSubseq ( str1 , str2 , n1 , n2 ) ) ; } }

Index/key variables: SIZE, i
Accumulator variables: i, len
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPanalphabeticWindow ( string 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 ; } public static void Main ( ) { string s = " abujm ▁ zvcd ▁ acefc ▁ deghf " + " ▁ gijklem ▁ n ▁ o ▁ p ▁ pafqrstuvwxyzfap " ; int n = s . Length ; if ( isPanalphabeticWindow ( s , n ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } }

Index/key variables: i
Accumulator variables: ch, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPrime ( int n ) { if ( n <= 1 ) return false ; for ( int i = 2 ; i < n ; i ++ ) if ( n % i == 0 ) return false ; return true ; } static void prime_index ( string input ) { int n = input . Length ; for ( int i = 2 ; i <= n ; i ++ ) if ( isPrime ( i ) ) Console . Write ( input [ i - 1 ] ) ; } public static void Main ( ) { string input = " GeeksforGeeks " ; prime_index ( input ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isHeterogram ( string s , int n ) { int [ ] hash = new int [ 26 ] ; 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 ; } public static void Main ( ) { string s = " the ▁ big ▁ dwarf ▁ only ▁ jumps " ; int n = s . Length ; if ( isHeterogram ( s , n ) ) 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 GeeksforGeeks { static void ASCIISentence ( string str ) { int l = str . Length ; int convert ; for ( int i = 0 ; i < l ; i ++ ) { convert = str [ i ] ; Console . Write ( convert ) ; } } public static void Main ( ) { string str = " GeeksforGeeks " ; Console . WriteLine ( " ASCII ▁ Sentence : " ) ; ASCIISentence ( str ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GeeksforGeeks
C# program:
using System ; class GFG { static void convert ( string str ) { int n = str . Length ; string str1 = " " ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] == ' ▁ ' ) str1 = str1 + ' _ ' ; else str1 = str1 + Char . ToLower ( str [ i ] ) ; } Console . Write ( str1 ) ; } static void Main ( ) { string str = " I ▁ got ▁ intern ▁ at ▁ geeksforgeeks " ; convert ( str ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int largestAnagramSet ( String [ ] arr , int n ) { int maxSize = 0 ; Dictionary < String , int > count = new Dictionary < String , int > ( ) ; for ( int i = 0 ; i < n ; ++ i ) { char [ ] temp = arr [ i ] . ToCharArray ( ) ; Array . Sort ( temp ) ; arr [ i ] = new String ( temp ) ; if ( count . ContainsKey ( arr [ i ] ) ) { count [ arr [ i ] ] = count [ arr [ i ] ] + 1 ; } else { count . Add ( arr [ i ] , 1 ) ; } maxSize = Math . Max ( maxSize , count [ arr [ i ] ] ) ; } return maxSize ; } public static void Main ( String [ ] args ) { String [ ] arr = { " ant " , " magenta " , " magnate " , " tan " , " gnamate " } ; int n = arr . Length ; Console . WriteLine ( largestAnagramSet ( arr , n ) ) ; String [ ] arr1 = { " cars " , " bikes " , " arcs " , " steer " } ; n = arr1 . Length ; Console . WriteLine ( largestAnagramSet ( arr1 , n ) ) ; } }

Index/key variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Globalization ; class GFG { static 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 = char . 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 ++ ; } Console . WriteLine ( " Vowels : ▁ " + vowels ) ; Console . WriteLine ( " Consonant : ▁ " + consonant ) ; Console . WriteLine ( " Digit : ▁ " + digit ) ; Console . WriteLine ( " Special ▁ Character : ▁ " + specialChar ) ; } static public void Main ( ) { string str = " geeks ▁ for ▁ geeks121" ; countCharacterType ( str ) ; } }

Index/key variables: i
Accumulator variables: consonant, digit, i, specialChar, vowels
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findNextWord ( char [ ] 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 ) { Console . WriteLine ( " - 1" ) ; } else { Console . WriteLine ( s ) ; } } public static void Main ( String [ ] args ) { char [ ] str = " abcd " . ToCharArray ( ) ; int k = 4 ; findNextWord ( str , k ) ; } }

Index/key variables: i
Accumulator variables: i, m
Class/struct names: GFG
C# program:
using System ; class GeeksforGeeks { static int Octal ( int decima ) { int octal = 0 ; String temp = " " ; while ( decima > 0 ) { int remainder = decima % 8 ; temp = remainder + temp ; decima /= 8 ; } for ( int i = 0 ; i < temp . Length ; i ++ ) octal = ( octal * 10 ) + ( temp [ i ] - '0' ) ; return octal ; } static String Hexadecimal ( int decima ) { String hex = " " ; while ( decima > 0 ) { int remainder = decima % 16 ; if ( remainder >= 0 && remainder <= 9 ) hex = remainder + hex ; else hex = ( char ) ( ' A ' + remainder % 10 ) + hex ; decima /= 16 ; } return hex ; } static String HTML ( int decima ) { String html = " " ; html = html + decima ; html = " & # " + html + " ; " ; return html ; } static void ASCIIlookuptable ( char ch ) { int decima = ch ; Console . WriteLine ( " Octal ▁ value : ▁ " + Octal ( decima ) ) ; Console . WriteLine ( " Decimal ▁ value : ▁ " + decima ) ; Console . WriteLine ( " Hexadecimal ▁ value : ▁ " + Hexadecimal ( decima ) ) ; Console . Write ( " HTML ▁ value : ▁ " + HTML ( decima ) ) ; } public static void Main ( ) { char ch = ' @ ' ; ASCIIlookuptable ( ch ) ; } }

Index/key variables: i
Accumulator variables: decima, i
Iterator variables: i
Class/struct names: GeeksforGeeks
C# program:
using System ; public class GFG { static String replace ( String s , char c1 , char c2 ) { int l = s . Length ; char [ ] arr = s . ToCharArray ( ) ; for ( int i = 0 ; i < l ; i ++ ) { if ( arr [ i ] == c1 ) arr [ i ] = c2 ; else if ( arr [ i ] == c2 ) arr [ i ] = c1 ; } return string . Join ( " " , arr ) ; } public static void Main ( ) { String s = " grrksfoegrrks " ; char c1 = ' e ' , c2 = ' r ' ; Console . WriteLine ( replace ( s , c1 , c2 ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static 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 ; } public static void Main ( ) { int n = 6 ; Console . WriteLine ( fibWord ( n ) ) ; } }

Accumulator variables: Sn, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static string decToBin ( int n ) { if ( n == 0 ) return "0" ; string bin = " " ; while ( n > 0 ) { bin = ( ( n & 1 ) == 0 ? '0' : '1' ) + bin ; n >>= 1 ; } return bin ; } static string convertBinToOct ( string bin ) { int l = bin . Length ; for ( int j = 1 ; j <= ( 3 - l % 3 ) % 3 ; j ++ ) bin = '0' + bin ; Dictionary < string , char > bin_oct_map = new Dictionary < string , char > ( ) ; bin_oct_map . Add ( "000" , '0' ) ; bin_oct_map . Add ( "001" , '1' ) ; bin_oct_map . Add ( "010" , '2' ) ; bin_oct_map . Add ( "011" , '3' ) ; bin_oct_map . Add ( "100" , '4' ) ; bin_oct_map . Add ( "101" , '5' ) ; bin_oct_map . Add ( "110" , '6' ) ; bin_oct_map . Add ( "111" , '7' ) ; int i = 0 ; string octal = " " ; while ( true ) { octal += bin_oct_map [ bin . Substring ( i , 3 ) ] ; i += 3 ; if ( i == bin . Length ) break ; } return octal ; } static string decToOctal ( int n ) { string bin = decToBin ( n ) ; return convertBinToOct ( bin ) ; } public static void Main ( string [ ] args ) { int n = 151 ; Console . Write ( decToOctal ( n ) ) ; } }

Accumulator variables: i, j, octal
Iterator variables: j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static List < String > splitStrings ( String str , char dl ) { String word = " " ; int num = 0 ; str = str + dl ; int l = str . Length ; List < String > substr_list = new List < String > ( ) ; for ( int i = 0 ; i < l ; i ++ ) { if ( str [ i ] != dl ) { word = word + str [ i ] ; } else { if ( ( int ) word . Length != 0 ) { substr_list . Add ( word ) ; } word = " " ; } } return substr_list ; } public static void Main ( ) { String str = " geeks ; for ; geeks " ; char dl = ' ; ' ; List < String > res = splitStrings ( str , dl ) ; foreach ( String x in res ) { Console . WriteLine ( x ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; class GFG { static String constructPalin ( char [ ] str , int len ) { int i = 0 , j = len - 1 ; for ( ; i < j ; i ++ , j -- ) { if ( str [ i ] == str [ j ] && str [ i ] != ' * ' ) continue ; else if ( str [ i ] == str [ j ] && str [ i ] == ' * ' ) { str [ i ] = ' a ' ; str [ j ] = ' a ' ; continue ; } else if ( str [ i ] == ' * ' ) { str [ i ] = str [ j ] ; continue ; } else if ( str [ j ] == ' * ' ) { str [ j ] = str [ i ] ; continue ; } Console . WriteLine ( " Not ▁ Possible " ) ; return " " ; } return String . Join ( " " , str ) ; } public static void Main ( String [ ] args ) { String str = " bca * xc * * b " ; int len = str . Length ; Console . WriteLine ( constructPalin ( str . ToCharArray ( ) , len ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static String conversion ( char [ ] charSet , String str ) { int n = str . Length ; char [ ] hashChar = new char [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) { int ch = Math . Abs ( charSet [ i ] - ' a ' ) ; hashChar [ ch ] = ( char ) ( ' a ' + i ) ; } String s = " " ; for ( int i = 0 ; i < n ; i ++ ) { s += hashChar [ str [ i ] - ' a ' ] ; } return s ; } public static void Main ( String [ ] args ) { char [ ] charSet = " qwertyuiopasdfghjklzxcvbnm " . ToCharArray ( ) ; String str = " egrt " ; str = conversion ( charSet , str ) ; Console . WriteLine ( str ) ; } }

Index/key variables: ch, i
Accumulator variables: i, s
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static char [ ] alphabets = " abcdefghijklmnopqrstuvwxyz " . ToCharArray ( ) ; static String conversion ( String charSet , char [ ] str1 ) { String s2 = " " ; foreach ( char i in str1 ) s2 += alphabets [ charSet . IndexOf ( i ) ] ; return s2 ; } public static void Main ( String [ ] args ) { String charSet = " qwertyuiopasdfghjklzxcvbnm " ; String str1 = " egrt " ; Console . Write ( conversion ( charSet , str1 . ToCharArray ( ) ) ) ; } }

Accumulator variables: s2
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int numberOfDifferentSubstrings ( String s , char a , char b ) { int ans = 0 ; int ls = s . Length ; int [ ] x = new int [ ls ] ; int [ ] y = new int [ ls ] ; for ( int i = 0 ; i < ls ; i ++ ) { if ( s [ i ] == a ) x [ i ] = 1 ; if ( s [ i ] == b ) y [ i ] = 1 ; } HashSet < String > hash = new HashSet < String > ( ) ; String curr_substr = " " ; for ( int i = 0 ; i < ls ; i ++ ) { if ( x [ i ] != 0 ) { for ( int j = i ; j < ls ; j ++ ) { if ( y [ j ] == 0 ) curr_substr += s [ i ] ; if ( y [ j ] != 0 ) { curr_substr += s [ j ] ; if ( ! hash . Contains ( curr_substr ) ) ans ++ ; hash . Add ( curr_substr ) ; } } curr_substr = " " ; } } return ans ; } public static void Main ( String [ ] args ) { String s = " codecppforfood " ; char begin = ' c ' ; char end = ' d ' ; Console . WriteLine ( numberOfDifferentSubstrings ( s , begin , end ) ) ; } }

Index/key variables: i, j, ls
Accumulator variables: ans, curr_substr, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int max = 100 ; static void carveCross ( String str ) { int n = str . Length ; if ( n % 2 == 0 ) { Console . Write ( " Not ▁ possible . ▁ Please ▁ enter ▁ " + " odd ▁ length ▁ string . " ) ; } else { char [ , ] arr = new char [ max , max ] ; int m = n / 2 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { arr [ i , j ] = ' X ' ; } } for ( int i = 0 ; i < n ; i ++ ) { arr [ i , m ] = str [ i ] ; } for ( int i = 0 ; i < n ; i ++ ) { arr [ m , i ] = str [ i ] ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { Console . Write ( arr [ i , j ] + " ▁ " ) ; } Console . WriteLine ( ) ; } } } public static void Main ( ) { string str = " PICTURE " ; carveCross ( str ) ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void generateString ( int n ) { String s = " " ; for ( int i = 0 ; i < n ; i ++ ) s += ( ( i & 2 ) > 1 ? ' b ' : ' a ' ) ; Console . WriteLine ( s ) ; } public static void Main ( String [ ] args ) { int n = 5 ; generateString ( n ) ; n = 8 ; generateString ( n ) ; n = 10 ; generateString ( n ) ; } }

Accumulator variables: i, s
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int remainder ( string str ) { int len = str . Length ; int num , rem = 0 ; for ( int i = 0 ; i < len ; i ++ ) { num = rem * 10 + ( str [ i ] - '0' ) ; rem = num % 11 ; } return rem ; } public static void Main ( ) { string str = "3435346456547566345436457867978" ; Console . WriteLine ( remainder ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int longestSubseq ( String s ) { int n = s . Length ; int [ ] pre_count_0 = new int [ n + 2 ] ; int [ ] pre_count_1 = new int [ n + 1 ] ; int [ ] post_count_0 = new int [ n + 2 ] ; pre_count_0 [ 0 ] = 0 ; post_count_0 [ n + 1 ] = 0 ; pre_count_1 [ 0 ] = 0 ; for ( int j = 1 ; j <= n ; j ++ ) { pre_count_0 [ j ] = pre_count_0 [ j - 1 ] ; pre_count_1 [ j ] = pre_count_1 [ j - 1 ] ; post_count_0 [ n - j + 1 ] = post_count_0 [ n - j + 2 ] ; if ( s [ j - 1 ] == '0' ) pre_count_0 [ j ] ++ ; else pre_count_1 [ j ] ++ ; if ( s [ n - j ] == '0' ) post_count_0 [ n - j + 1 ] ++ ; } if ( pre_count_0 [ n ] == n pre_count_0 [ n ] == 0 ) return n ; int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) for ( int j = i ; j <= n ; j ++ ) ans = Math . Max ( pre_count_0 [ i - 1 ] + pre_count_1 [ j ] - pre_count_1 [ i - 1 ] + post_count_0 [ j + 1 ] , ans ) ; return ans ; } public static void Main ( String [ ] args ) { String s = "000011100000" ; Console . WriteLine ( longestSubseq ( s ) ) ; } }

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