dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
class GFG { static final int N = 20 ; static int countPair ( char str [ ] [ ] , int n ) { int [ ] cnt = new int [ 1 << 10 ] ; for ( int i = 0 ; i < n ; i ++ ) { int mask = 0 ; for ( int j = 0 ; j < str [ i ] . length ; ++ j ) mask |= ( 1 << ( str [ i ] [ j ] - '0' ) ) ; cnt [ mask ] ++ ; } int ans = 0 ; for ( int m1 = 0 ; m1 <= 1023 ; m1 ++ ) for ( int m2 = 0 ; m2 <= 1023 ; m2 ++ ) if ( ( m1 m2 ) == 1023 ) { ans += ( ( m1 == m2 ) ? ( cnt [ m1 ] * ( cnt [ m1 ] - 1 ) ) : ( cnt [ m1 ] * cnt [ m2 ] ) ) ; } return ans / 2 ; } public static void main ( String [ ] args ) { int n = 5 ; char str [ ] [ ] = { "129300455" . toCharArray ( ) , "5559948277" . toCharArray ( ) , "012334556" . toCharArray ( ) , "56789" . toCharArray ( ) , "123456879" . toCharArray ( ) } ; System . out . print ( countPair ( str , n ) + "NEW_LINE"); } }

Index/key variables: i, j, m1, m2, mask
Accumulator variables: ans, i, m1, m2, mask
Iterator variables: i, j, m1, m2
Class/struct names: GFG
Java program:
class GFG { static final long mod = 1000000007 ; static final long max = 1001 ; static long nCr [ ] [ ] = new long [ 1003 ] [ 1003 ] ; static void preComputeCoeff ( ) { for ( int i = 0 ; i < max ; i ++ ) { for ( int j = 0 ; j <= i ; j ++ ) { if ( j == 0 j == i ) nCr [ i ] [ j ] = 1 ; else nCr [ i ] [ j ] = ( nCr [ i - 1 ] [ j - 1 ] + nCr [ i - 1 ] [ j ] ) % mod ; } } } static long computeStringCount ( int N ) { int n = N / 2 ; long ans = 0 ; for ( int i = 2 ; i <= n ; i += 2 ) ans = ( ans + ( ( nCr [ n ] [ i ] * nCr [ n ] [ i / 2 ] ) % mod ) ) % mod ; return ans ; } public static void main ( String [ ] args ) { preComputeCoeff ( ) ; int N = 3 ; System . out . println ( computeStringCount ( N ) ) ; } }

Index/key variables: i, j, n
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
public class GFG { static int max = 100 ; static void countSubsequence ( String s , int n ) { int cntG = 0 , cntF = 0 , result = 0 , C = 0 ; for ( int i = 0 ; i < n ; i ++ ) { switch ( s . charAt ( i ) ) { case ' G ' : cntG ++ ; result += C ; break ; case ' F ' : cntF ++ ; C += cntG ; break ; default : continue ; } } System . out . println ( result ) ; } public static void main ( String args [ ] ) { String s = " GFGFG " ; int n = s . length ( ) ; countSubsequence ( s , n ) ; } }

Accumulator variables: C, cntF, cntG, i, result
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static String LexicographicalMaxString ( String str ) { String mx = " " ; for ( int i = 0 ; i < str . length ( ) ; ++ i ) { if ( mx . compareTo ( str . substring ( i ) ) <= 0 ) { mx = str . substring ( i ) ; } } return mx ; } public static void main ( String [ ] args ) { String str = " ababaa " ; System . out . println ( LexicographicalMaxString ( str ) ) ; } }

Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static String LexicographicalMaxString ( String str ) { char maxchar = ' a ' ; ArrayList < Integer > index = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) >= maxchar ) { maxchar = str . charAt ( i ) ; index . add ( i ) ; } } String maxstring = " " ; for ( int i = 0 ; i < index . size ( ) ; i ++ ) { if ( str . substring ( index . get ( i ) , str . length ( ) ) . compareTo ( maxstring ) > 0 ) { maxstring = str . substring ( index . get ( i ) , str . length ( ) ) ; } } return maxstring ; } public static void main ( String [ ] args ) { String str = " acbacbc " ; System . out . println ( LexicographicalMaxString ( str ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static boolean checkPalin ( String word ) { int n = word . length ( ) ; word = word . toLowerCase ( ) ; for ( int i = 0 ; i < n ; i ++ , n -- ) if ( word . charAt ( i ) != word . charAt ( n - 1 ) ) return false ; return true ; } static String longestPalin ( String str ) { str = str + " ▁ " ; String longestword = " " , word = " " ; int length , length1 = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { char ch = str . charAt ( i ) ; if ( ch != ' ▁ ' ) word = word + ch ; else { length = word . length ( ) ; if ( checkPalin ( word ) && length > length1 ) { length1 = length ; longestword = word ; } word = " " ; } } return longestword ; } public static void main ( String args [ ] ) { String s = new String ( " My ▁ name ▁ is ▁ ava ▁ " + " and ▁ i ▁ love ▁ Geeksforgeeks " ) ; if ( longestPalin ( s ) == " " ) System . out . println ( " No ▁ Palindrome " + " ▁ Word " ) ; else System . out . println ( longestPalin ( s ) ) ; } }

Accumulator variables: i, n
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean isCommonBase ( String base , String s1 , String s2 ) { for ( int j = 0 ; j < s1 . length ( ) ; ++ j ) { if ( base . charAt ( j % base . length ( ) ) != s1 . charAt ( j ) ) { return false ; } } for ( int j = 0 ; j < s2 . length ( ) ; ++ j ) { if ( base . charAt ( j % base . length ( ) ) != s2 . charAt ( j ) ) { return false ; } } return true ; } static int countCommonBases ( String s1 , String s2 ) { int n1 = s1 . length ( ) , n2 = s2 . length ( ) ; int count = 0 ; for ( int i = 1 ; i <= Math . min ( n1 , n2 ) ; i ++ ) { String base = s1 . substring ( 0 , i ) ; if ( isCommonBase ( base , s1 , s2 ) ) { count ++ ; } } return count ; } public static void main ( String [ ] args ) { String s1 = " pqrspqrs " ; String s2 = " pqrspqrspqrspqrs " ; System . out . println ( countCommonBases ( s1 , s2 ) ) ; } }

Accumulator variables: count, i
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; public class GFG { static String findstring ( String s ) { int n = s . length ( ) ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( ( s . charAt ( i - 1 ) == '0' && s . charAt ( i + 1 ) == '0' ) ) { s = s . substring ( 0 , i ) + s . substring ( i + 1 ) ; i -- ; if ( i > 0 && s . charAt ( i - 1 ) == '0' ) i -- ; n = s . length ( ) ; } } return s ; } public static void main ( String [ ] args ) { String s = "100100" ; System . out . println ( findstring ( s ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean isPerfectSquareString ( String str ) { int sum = 0 ; int len = str . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) sum += ( int ) str . charAt ( i ) ; long squareRoot = ( long ) Math . sqrt ( sum ) ; return ( ( squareRoot - Math . floor ( squareRoot ) ) == 0 ) ; } public static void main ( String [ ] args ) { String str = " d " ; if ( isPerfectSquareString ( str ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int find_sub ( String s , int k ) { int len = s . length ( ) ; int lp = 0 , rp = 0 ; int ans = 0 ; int [ ] hash_char = new int [ 26 ] ; for ( ; rp < len ; rp ++ ) { hash_char [ s . charAt ( rp ) - ' a ' ] ++ ; while ( hash_char [ s . charAt ( rp ) - ' a ' ] > k ) { hash_char [ s . charAt ( lp ) - ' a ' ] -- ; lp ++ ; } ans += rp - lp + 1 ; } return ans ; } public static void main ( String [ ] args ) { String S = " aaabb " ; int k = 2 ; System . out . println ( find_sub ( S , k ) ) ; } }

Accumulator variables: ans, lp, rp
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; import java . lang . * ; class GFG { static boolean is_vow ( char c ) { return ( c == ' a ' ) || ( c == ' e ' ) || ( c == ' i ' ) || ( c == ' o ' ) || ( c == ' u ' ) ; } static void removeVowels ( String str ) { System . out . print ( str . charAt ( 0 ) ) ; for ( int i = 1 ; i < str . length ( ) ; i ++ ) if ( ( ! is_vow ( str . charAt ( i - 1 ) ) ) || ( ! is_vow ( str . charAt ( i ) ) ) ) System . out . print ( str . charAt ( i ) ) ; } public static void main ( String [ ] args ) { String str = " geeks ▁ for ▁ geeks " ; removeVowels ( str ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static void printNumbers ( int n , int d ) { String st = " " + d ; char ch = st . charAt ( 0 ) ; for ( int i = 0 ; i <= n ; i ++ ) { st = " " ; st = st + i ; if ( i == d || st . indexOf ( ch ) >= 0 ) System . out . print ( i + " ▁ " ) ; } } public static void main ( String [ ] args ) { int n = 100 , d = 5 ; printNumbers ( n , d ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; public class GFG { static boolean transformString ( StringBuilder s ) { char ch = ' a ' ; if ( s . length ( ) < 26 ) return false ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( ( int ) ch > ( int ) ' z ' ) break ; if ( s . charAt ( i ) <= ch ) { s . setCharAt ( i , ch ) ; ch = ( char ) ( ( int ) ch + 1 ) ; } } if ( ch <= ' z ' ) return false ; return true ; } public static void main ( String args [ ] ) { StringBuilder str = new StringBuilder ( " aaaaaaaaaaaaaaaaaaaaaaaaaa " ) ; if ( transformString ( str ) ) System . out . println ( str . toString ( ) ) ; else System . out . println ( " Not ▁ Possible " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static ArrayList < String > v = new ArrayList < String > ( ) ; static int isPanDigital ( String s ) { int digits [ ] = new int [ 10 ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) digits [ s . charAt ( i ) - ( int ) '0' ] = 1 ; for ( int i = 0 ; i <= 9 ; i ++ ) if ( digits [ i ] == 0 ) return 0 ; return 1 ; } static int countPandigitalPairs ( ) { int pairs = 0 ; for ( int i = 0 ; i < v . size ( ) ; i ++ ) for ( int j = i + 1 ; j < v . size ( ) ; j ++ ) if ( isPanDigital ( v . get ( i ) + v . get ( j ) ) == 1 ) pairs ++ ; return pairs ; } public static void main ( String args [ ] ) { v . add ( "123567" ) ; v . add ( "098234" ) ; v . add ( "14765" ) ; v . add ( "19804" ) ; System . out . print ( countPandigitalPairs ( ) ) ; } }

Index/key variables: i
Accumulator variables: i, j, pairs
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int pandigitalMask = ( ( 1 << 10 ) - 1 ) ; static void computeMaskFrequencies ( Vector < String > v , HashMap < Integer , Integer > freq ) { for ( int i = 0 ; i < v . size ( ) ; i ++ ) { int mask = 0 ; HashSet < Integer > digits = new HashSet < > ( ) ; for ( int j = 0 ; j < v . get ( i ) . length ( ) ; j ++ ) digits . add ( v . get ( i ) . charAt ( j ) - '0' ) ; for ( int it : digits ) { int digit = ( it ) ; mask += ( 1 << digit ) ; } if ( freq . containsKey ( mask ) ) { freq . put ( mask , freq . get ( mask ) + 1 ) ; } else { freq . put ( mask , 1 ) ; } } } static int pandigitalConcatenations ( HashMap < Integer , Integer > freq ) { int ans = 0 ; for ( int i = 1 ; i <= 1023 ; i ++ ) { for ( int j = 1 ; j <= 1023 ; j ++ ) { if ( ( i j ) == pandigitalMask && freq . containsKey ( j ) && freq . containsKey ( i ) ) { if ( i == j ) ans += ( freq . get ( i ) * ( freq . get ( i ) - 1 ) ) ; else ans += ( freq . get ( i ) * freq . get ( j ) ) ; } } } return ans / 2 ; } static int countPandigitalPairs ( Vector < String > v ) { HashMap < Integer , Integer > freq = new HashMap < > ( ) ; computeMaskFrequencies ( v , freq ) ; return pandigitalConcatenations ( freq ) ; } public static void main ( String [ ] args ) { Vector < String > v = new Vector < > ( ) ; v . add ( "123567" ) ; v . add ( "098234" ) ; v . add ( "14765" ) ; v . add ( "19804" ) ; System . out . print ( countPandigitalPairs ( v ) + "NEW_LINE"); } }

Accumulator variables: ans, i, j, mask
Iterator variables: i, it, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int MAX = 256 ; static void printPalindromePos ( String str ) { Vector < Integer > [ ] pos = new Vector [ MAX ] ; for ( int i = 0 ; i < MAX ; i ++ ) pos [ i ] = new Vector < Integer > ( ) ; int n = str . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) pos [ str . charAt ( i ) ] . add ( i + 1 ) ; int oddCount = 0 ; char oddChar = 0 ; for ( int i = 0 ; i < MAX ; i ++ ) { if ( pos [ i ] . size ( ) % 2 != 0 ) { oddCount ++ ; oddChar = ( char ) i ; } } if ( oddCount > 1 ) System . out . print ( " NO ▁ PALINDROME " ) ; for ( int i = 0 ; i < MAX ; i ++ ) { int mid = pos [ i ] . size ( ) / 2 ; for ( int j = 0 ; j < mid ; j ++ ) System . out . print ( pos [ i ] . get ( j ) + " ▁ " ) ; } if ( oddCount > 0 ) { int last = pos [ oddChar ] . size ( ) - 1 ; System . out . print ( pos [ oddChar ] . get ( last ) + " ▁ " ) ; pos [ oddChar ] . remove ( pos [ oddChar ] . size ( ) - 1 ) ; } for ( int i = MAX - 1 ; i >= 0 ; i -- ) { int count = pos [ i ] . size ( ) ; for ( int j = count / 2 ; j < count ; j ++ ) System . out . print ( pos [ i ] . get ( j ) + " ▁ " ) ; } } public static void main ( String [ ] args ) { String s = " geeksgk " ; printPalindromePos ( s ) ; } }

Index/key variables: MAX, i, oddChar
Accumulator variables: i, j, oddCount
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . lang . * ; import java . util . * ; class GFG { static final int MAX_CHAR = 26 ; public static int minChanges ( String str ) { int n = str . length ( ) ; if ( n > MAX_CHAR ) return - 1 ; int dist_count = 0 ; int count [ ] = new int [ MAX_CHAR ] ; for ( int i = 0 ; i < MAX_CHAR ; i ++ ) count [ i ] = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( count [ str . charAt ( i ) - ' a ' ] == 0 ) dist_count ++ ; count [ str . charAt ( i ) - ' a ' ] ++ ; } return ( n - dist_count ) ; } public static void main ( String [ ] args ) { String str = " aebaecedabbee " ; System . out . println ( minChanges ( str ) ) ; } }

Index/key variables: MAX_CHAR, i
Accumulator variables: dist_count, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static class Node { String c ; Node next ; } ; static Node newNode ( String c ) { Node temp = new Node ( ) ; temp . c = c ; temp . next = null ; return temp ; } ; static String reverse_word ( String str ) { String s = " " ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) s = str . charAt ( i ) + s ; return s ; } static Node reverse ( Node head ) { Node ptr = head ; while ( ptr != null ) { ptr . c = reverse_word ( ptr . c ) ; ptr = ptr . next ; } return head ; } static void printList ( Node head ) { while ( head != null ) { System . out . print ( head . c + " ▁ " ) ; head = head . next ; } } public static void main ( String args [ ] ) { Node head = newNode ( " Geeksforgeeks " ) ; head . next = newNode ( " a " ) ; head . next . next = newNode ( " computer " ) ; head . next . next . next = newNode ( " science " ) ; head . next . next . next . next = newNode ( " portal " ) ; head . next . next . next . next . next = newNode ( " for " ) ; head . next . next . next . next . next . next = newNode ( " geeks " ) ; System . out . print ( "List before reverse: NEW_LINE"); printList ( head ) ; head = reverse ( head ) ; System . out . print ( " List after reverse : "); printList ( head ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, Node
Java program:
import java . io . * ; class GFG { static int numofstring ( int n , int m ) { if ( n == 1 ) return m ; if ( n == 2 ) return m * ( m - 1 ) ; return m * ( m - 1 ) * ( int ) Math . pow ( m - 2 , n - 2 ) ; } public static void main ( String [ ] args ) { int n = 2 , m = 3 ; System . out . println ( numofstring ( n , m ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; import java . lang . * ; class GFG { public static int CountSpecialPalindrome ( String str ) { int n = str . length ( ) ; int result = 0 ; int [ ] sameChar = new int [ n ] ; for ( int v = 0 ; v < n ; v ++ ) sameChar [ v ] = 0 ; int i = 0 ; while ( i < n ) { int sameCharCount = 1 ; int j = i + 1 ; while ( j < n && str . charAt ( i ) == str . charAt ( j ) ) { sameCharCount ++ ; j ++ ; } result += ( sameCharCount * ( sameCharCount + 1 ) / 2 ) ; sameChar [ i ] = sameCharCount ; i = j ; } for ( int j = 1 ; j < n ; j ++ ) { if ( str . charAt ( j ) == str . charAt ( j - 1 ) ) sameChar [ j ] = sameChar [ j - 1 ] ; if ( j > 0 && j < ( n - 1 ) && ( str . charAt ( j - 1 ) == str . charAt ( j + 1 ) && str . charAt ( j ) != str . charAt ( j - 1 ) ) ) result += Math . min ( sameChar [ j - 1 ] , sameChar [ j + 1 ] ) ; } return result - n ; } public static void main ( String args [ ] ) { String str = " abccba " ; System . out . print ( CountSpecialPalindrome ( str ) ) ; } }

Index/key variables: i, j, n, v
Accumulator variables: j, result, sameCharCount, v
Iterator variables: j, v
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static void printBracketNumber ( String exp , int n ) { int left_bnum = 1 ; Stack < Integer > right_bnum = new Stack < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( exp . charAt ( i ) == ' ( ' ) { System . out . print ( left_bnum + " ▁ " ) ; right_bnum . push ( left_bnum ) ; left_bnum ++ ; } else if ( exp . charAt ( i ) == ' ) ' ) { System . out . print ( right_bnum . peek ( ) + " ▁ " ) ; right_bnum . pop ( ) ; } } } public static void main ( String args [ ] ) { String exp = " ( a + ( b * c ) ) + ( d / e ) " ; int n = exp . length ( ) ; printBracketNumber ( exp , n ) ; } }

Accumulator variables: i, left_bnum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean isCornerPresent ( String str , String corner ) { int n = str . length ( ) ; int cl = corner . length ( ) ; if ( n < cl ) return false ; return ( str . substring ( 0 , cl ) . equals ( corner ) && str . substring ( n - cl , n ) . equals ( corner ) ) ; } public static void main ( String [ ] args ) { String str = " geeksforgeeks " ; String corner = " geeks " ; if ( isCornerPresent ( str , corner ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . Arrays ; class GFG { static String s = " " ; static String ReverseString ( String s ) { char [ ] arr = s . toCharArray ( ) ; for ( int i = 0 ; i < arr . length / 2 ; i ++ ) { char temp = arr [ i ] ; arr [ i ] = arr [ arr . length - i - 1 ] ; arr [ arr . length - i - 1 ] = temp ; } return new String ( arr ) ; } static void binary_conversion ( int m ) { while ( m != 0 ) { int tmp = m % 2 ; s += Integer . toString ( tmp ) ; m = ( int ) ( m / 2 ) ; } s = ReverseString ( s ) ; } static int find_character ( int n , int m , int i ) { binary_conversion ( m ) ; String s1 = " " ; for ( int x = 0 ; x < n ; x ++ ) { for ( int y = 0 ; y < s . length ( ) ; y ++ ) { if ( s . charAt ( y ) == '1' ) s1 += "10" ; else s1 += "01" ; } s = s1 ; s1 = " " ; } return s . charAt ( i ) - '0' ; } public static void main ( String args [ ] ) { int m = 5 , n = 2 , i = 8 ; System . out . print ( find_character ( n , m , i ) ) ; } }

Index/key variables: i
Accumulator variables: i, s, s1, x, y
Iterator variables: i, x, y
Class/struct names: GFG
Java program:
class GFG { static 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 . charAt ( i ) - '0' ) ; int seg_len_pow = ( int ) Math . pow ( 10 , seg_len - 1 ) ; int curr_val = res ; for ( int i = 1 ; i <= ( s . length ( ) - seg_len ) ; i ++ ) { curr_val = curr_val - ( s . charAt ( i - 1 ) - '0' ) * seg_len_pow ; curr_val = curr_val * 10 + ( s . charAt ( i + seg_len - 1 ) - '0' ) ; res = Math . max ( res , curr_val ) ; } return res ; } public static void main ( String [ ] args ) { String s = "8754" ; int k = 2 ; System . out . print ( " Maximum ▁ number ▁ = ▁ " + findMaxSegment ( s , k ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int isConsecutive ( String str ) { int start ; int length = str . length ( ) ; for ( int i = 0 ; i < length / 2 ; i ++ ) { String new_str = str . substring ( 0 , i + 1 ) ; int num = Integer . parseInt ( new_str ) ; start = num ; while ( new_str . length ( ) < length ) { num ++ ; new_str = new_str + String . valueOf ( num ) ; } if ( new_str . equals ( str ) ) return start ; } return - 1 ; } public static void main ( String [ ] args ) { String str = "99100" ; System . out . println ( " String : ▁ " + str ) ; int start = isConsecutive ( str ) ; if ( start != - 1 ) System . out . println ( "Yes NEW_LINE" + start); else System . out . println ( " No " ) ; String str1 = "121315" ; System . out . println ( " String : " + str1); start = isConsecutive ( str1 ) ; if ( start != - 1 ) System . out . println ( "Yes NEW_LINE" + start); else System . out . println ( " No " ) ; } }

Accumulator variables: i, num
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean isConvertible ( String str1 , String str2 , int k ) { if ( ( str1 . length ( ) + str2 . length ( ) ) < k ) return true ; int commonLength = 0 ; for ( int i = 0 ; i < Math . min ( str1 . length ( ) , str2 . length ( ) ) ; i ++ ) { if ( str1 == str2 ) commonLength ++ ; else break ; } if ( ( k - str1 . length ( ) - str2 . length ( ) + 2 * commonLength ) % 2 == 0 ) return true ; return false ; } public static void main ( String [ ] args ) { String str1 = " geek " ; String str2 = " geek " ; int k = 7 ; if ( isConvertible ( str1 , str2 , k ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; str1 = " geeks " ; str2 = " geek " ; k = 5 ; if ( isConvertible ( str1 , str2 , k ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: commonLength, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . Arrays ; class GFG { static final int MAX_CHAR = 26 ; static int maxLower ( String str ) { int n = str . length ( ) ; int i = 0 ; for ( ; i < n ; i ++ ) { if ( str . charAt ( i ) >= ' A ' && str . charAt ( i ) <= ' Z ' ) { i ++ ; break ; } } int maxCount = 0 ; int count [ ] = new int [ MAX_CHAR ] ; for ( ; i < n ; i ++ ) { if ( str . charAt ( i ) >= ' A ' && str . charAt ( i ) <= ' Z ' ) { int currCount = 0 ; for ( int j = 0 ; j < MAX_CHAR ; j ++ ) { if ( count [ j ] > 0 ) { currCount ++ ; } } maxCount = Math . max ( maxCount , currCount ) ; Arrays . fill ( count , 0 ) ; } if ( str . charAt ( i ) >= ' a ' && str . charAt ( i ) <= ' z ' ) { count [ str . charAt ( i ) - ' a ' ] ++ ; } } return maxCount ; } public static void main ( String [ ] args ) { String str = " zACaAbbaazzC " ; System . out . println ( maxLower ( str ) ) ; } }

Index/key variables: MAX_CHAR, j
Accumulator variables: currCount, i, j
Iterator variables: j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int maxLower ( char [ ] str ) { int n = str . length ; int i = 0 ; for ( ; i < n ; i ++ ) { if ( str [ i ] >= ' A ' && str [ i ] <= ' Z ' ) { i ++ ; break ; } } int maxCount = 0 ; HashSet < Integer > s = new HashSet < Integer > ( ) ; for ( ; i < n ; i ++ ) { if ( str [ i ] >= ' A ' && str [ i ] <= ' Z ' ) { maxCount = Math . max ( maxCount , ( int ) s . size ( ) ) ; s . clear ( ) ; } if ( str [ i ] >= ' a ' && str [ i ] <= ' z ' ) s . add ( ( int ) str [ i ] ) ; } return maxCount ; } public static void main ( String args [ ] ) { String str = " zACaAbbaazzC " ; System . out . println ( maxLower ( str . toCharArray ( ) ) ) ; } }

Index/key variables: i
Accumulator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static char first ( String str ) { for ( int i = 0 ; i < str . length ( ) ; i ++ ) if ( Character . isUpperCase ( str . charAt ( i ) ) ) return str . charAt ( i ) ; return 0 ; } public static void main ( String args [ ] ) { String str = " geeksforGeeKS " ; char res = first ( str ) ; if ( res == 0 ) System . out . println ( " No ▁ uppercase ▁ letter " ) ; else System . out . println ( res ) ; } }

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