codeparrot/xlcost-text-to-code huggingface dataset:
Number of co | Java program for the above approach ; Function to check whether given integers are co - prime or not ; Utility function to count number of co - prime pairs ; Traverse the array ; If co - prime ; Increment count ; Return count ; Function to count number of co - prime pairs ; Stores digits in string form ; Sort the list ; Keep two copies of list l ; Generate 2 digit numbers using d1 and d2 ; If current number does not exceed N ; Stores length of list ; Stores number of co - prime pairs ; Print number of co - prime pairs ; Driver Code ; Given value of N , d1 , d2 ; Function call to count number of co - prime pairs
import java . util . * ; class GFG { static int GCD ( int a , int b ) { return b == 0 ? a : GCD ( b , a % b ) ; } static boolean coprime ( int a , int b ) { if ( GCD ( a , b ) == 1 ) return true ; return false ; } static int numOfPairs ( ArrayList < String > arr , int N ) { int count = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { if ( coprime ( Integer . parseInt ( arr . get ( i ) ) , Integer . parseInt ( arr . get ( j ) ) ) ) { count = count + 1 ; } } } return count ; } static void noOfCoPrimePairs ( int N , int d1 , int d2 ) { ArrayList < String > l = new ArrayList < String > ( ) ; l . add ( Integer . toString ( d1 ) ) ; l . add ( Integer . toString ( d2 ) ) ; Collections . sort ( l ) ; if ( N < Integer . parseInt ( l . get ( 1 ) ) ) return ; ArrayList < String > total = new ArrayList < String > ( l ) ; ArrayList < String > temp2 = new ArrayList < String > ( l ) ; int flag = 0 ; ArrayList < String > temp3 = new ArrayList < String > ( l ) ; while ( l . get ( 0 ) . length ( ) < 10 ) { for ( int i = 0 ; i < l . size ( ) ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { if ( Integer . parseInt ( l . get ( i ) + temp2 . get ( j ) ) > N ) { flag = 1 ; break ; } total . add ( l . get ( i ) + temp2 . get ( j ) ) ; temp3 . add ( l . get ( i ) + temp2 . get ( j ) ) ; } if ( flag == 1 ) break ; } if ( flag == 1 ) break ; l = temp3 ; temp3 . clear ( ) ; } int lenOfTotal = total . size ( ) ; int ans = numOfPairs ( total , lenOfTotal ) ; System . out . print ( ans ) ; } public static void main ( String args [ ] ) { int N = 30 , d1 = 2 , d2 = 3 ; noOfCoPrimePairs ( N , d1 , d2 ) ; } }
Minimize cost of placing tiles of dimensions 2 * 1 over a Matrix | Java program for the above approach ; Function to find the minimum cost in placing N tiles in a grid M [ ] [ ] ; Stores the minimum profit after placing i tiles ; Traverse the grid [ ] [ ] ; Update the orig_cost ; Traverse over the range [ 2 , N ] ; Place tiles horizentally or vertically ; Print the answer ; Driver Code
import java . util . * ; class GFG { static void tile_placing ( int [ ] [ ] grid , int N ) { int dp [ ] = new int [ N + 5 ] ; Arrays . fill ( dp , 0 ) ; int orig_cost = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { orig_cost += grid [ i ] [ j ] ; } } dp [ 0 ] = 0 ; dp [ 1 ] = Math . abs ( grid [ 0 ] [ 0 ] - grid [ 1 ] [ 0 ] ) ; for ( int i = 2 ; i <= N ; i ++ ) { dp [ i ] = Math . max ( dp [ i - 1 ] + Math . abs ( grid [ 0 ] [ i - 1 ] - grid [ 1 ] [ i - 1 ] ) , dp [ i - 2 ] + Math . abs ( grid [ 0 ] [ i - 2 ] - grid [ 0 ] [ i - 1 ] ) + Math . abs ( grid [ 1 ] [ i - 2 ] - grid [ 1 ] [ i - 1 ] ) ) ; } System . out . println ( orig_cost - dp [ N ] ) ; } public static void main ( String [ ] args ) { int [ ] [ ] M = { { 7 , 5 , 1 , 3 } , { 8 , 6 , 0 , 2 } } ; int N = M [ 0 ] . length ; tile_placing ( M , N ) ; } }
Print indices of pair of array elements required to be removed to split array into 3 equal sum subarrays | Java program for the above approach ; Function to check if array can be split into three equal sum subarrays by removing two elements ; Stores sum of all three subarrays ; Sum of left subarray ; Sum of middle subarray ; Sum of right subarray ; Check if sum of subarrays are equal ; Print the possible pair ; If no pair exists , print - 1 ; Driver Code ; Given array ; Size of the array
import java . util . * ; class GFG { static void findSplit ( int arr [ ] , int N ) { for ( int l = 1 ; l <= N - 4 ; l ++ ) { for ( int r = l + 2 ; r <= N - 2 ; r ++ ) { int lsum = 0 , rsum = 0 , msum = 0 ; for ( int i = 0 ; i <= l - 1 ; i ++ ) { lsum += arr [ i ] ; } for ( int i = l + 1 ; i <= r - 1 ; i ++ ) { msum += arr [ i ] ; } for ( int i = r + 1 ; i < N ; i ++ ) { rsum += arr [ i ] ; } if ( lsum == rsum && rsum == msum ) { System . out . println ( l + " ▁ " + r ) ; return ; } } } System . out . print ( - 1 ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 5 , 12 , 7 , 19 , 4 , 3 } ; int N = arr . length ; findSplit ( arr , N ) ; } }
Count the number of times a Bulb switches its state | Java implementation of the above approach ; Function to find the number of times a bulb switches its state ; Count of 1 s ; Traverse the array ; Update count of 1 s ; Update the status of bulb ; Traverse the array Q [ ] ; Stores previous state of the bulb ; Toggle the switch and update count of 1 s ; If the bulb switches state ; Return count ; Driver Code ; Input ; Queries ; Function call to find number of times the bulb toggles
import java . util . * ; public class Main { static int solve ( int [ ] A , int n , int Q [ ] , int q ) { int one = 0 ; for ( int i = 0 ; i < n ; i ++ ) if ( A [ i ] == 1 ) one ++ ; int glows = 0 , count = 0 ; if ( one >= ( int ) Math . ceil ( n / 2 ) ) glows = 1 ; for ( int i = 0 ; i < q ; i ++ ) { int prev = glows ; if ( A [ Q [ i ] - 1 ] == 1 ) one -- ; if ( A [ Q [ i ] - 1 ] == 0 ) one ++ ; A [ Q [ i ] - 1 ] ^= 1 ; if ( one >= ( int ) Math . ceil ( n / 2.0 ) ) { glows = 1 ; } else { glows = 0 ; } if ( prev != glows ) count ++ ; } return count ; } public static void main ( String args [ ] ) { int n = 3 ; int arr [ ] = { 1 , 1 , 0 } ; int q = 3 ; int Q [ ] = { 3 , 2 , 1 } ; System . out . println ( solve ( arr , n , Q , q ) ) ; } }
Count array elements having sum of digits equal to K | Java program for the above approach ; Function to calculate the sum of digits of the number N ; Stores the sum of digits ; Return the sum ; Function to count array elements ; Store the count of array elements having sum of digits K ; Traverse the array ; If sum of digits is equal to K ; Increment the count ; Print the count ; Driver code ; Given array ; Given value of K ; Size of the array ; Function call to count array elements having sum of digits equal to K
public class GFG { static int sumOfDigits ( int N ) { int sum = 0 ; while ( N != 0 ) { sum += N % 10 ; N /= 10 ; } return sum ; } static void elementsHavingDigitSumK ( int [ ] arr , int N , int K ) { int count = 0 ; for ( int i = 0 ; i < N ; ++ i ) { if ( sumOfDigits ( arr [ i ] ) == K ) { count ++ ; } } System . out . println ( count ) ; } public static void main ( String args [ ] ) { int [ ] arr = { 23 , 54 , 87 , 29 , 92 , 62 } ; int K = 11 ; int N = arr . length ; elementsHavingDigitSumK ( arr , N , K ) ; } }
Postfix to Infix | Java program to find infix for a given postfix . ; Get Infix for a given postfix expression ; Push operands ; We assume that input is a valid postfix and expect an operator . ; There must be a single element in stack now which is the required infix . ; Driver code
import java . util . * ; class GFG { static boolean isOperand ( char x ) { return ( x >= ' a ' && x <= ' z ' ) || ( x >= ' A ' && x <= ' Z ' ) ; } static String getInfix ( String exp ) { Stack < String > s = new Stack < String > ( ) ; for ( int i = 0 ; i < exp . length ( ) ; i ++ ) { if ( isOperand ( exp . charAt ( i ) ) ) { s . push ( exp . charAt ( i ) + " " ) ; } else { String op1 = s . peek ( ) ; s . pop ( ) ; String op2 = s . peek ( ) ; s . pop ( ) ; s . push ( " ( " + op2 + exp . charAt ( i ) + op1 + " ) " ) ; } } return s . peek ( ) ; } public static void main ( String args [ ] ) { String exp = " ab * c + " ; System . out . println ( getInfix ( exp ) ) ; } }
Change a Binary Tree so that every node stores sum of all nodes in left subtree | Java program to store sum of nodes in left subtree in every node ; A tree node ; Function to modify a Binary Tree so that every node stores sum of values in its left child including its own value ; Base cases ; Update left and right subtrees ; Add leftsum to current node ; Return sum of values under root ; Utility function to do inorder traversal ; Utility function to create a new node ; Driver program ; Let us construct below tree 1 / \ 2 3 / \ \ 4 5 6
class GfG { static class node { int data ; node left , right ; } static int updatetree ( node root ) { if ( root == null ) return 0 ; if ( root . left == null && root . right == null ) return root . data ; int leftsum = updatetree ( root . left ) ; int rightsum = updatetree ( root . right ) ; root . data += leftsum ; return root . data + rightsum ; } static void inorder ( node node ) { if ( node == null ) return ; inorder ( node . left ) ; System . out . print ( node . data + " ▁ " ) ; inorder ( node . right ) ; } static node newNode ( int data ) { node node = new node ( ) ; node . data = data ; node . left = null ; node . right = null ; return ( node ) ; } public static void main ( String [ ] args ) { node root = newNode ( 1 ) ; root . left = newNode ( 2 ) ; root . right = newNode ( 3 ) ; root . left . left = newNode ( 4 ) ; root . left . right = newNode ( 5 ) ; root . right . right = newNode ( 6 ) ; updatetree ( root ) ; System . out . println ( " Inorder ▁ traversal ▁ of ▁ the ▁ modified ▁ tree ▁ is " ) ; inorder ( root ) ; } }
The Stock Span Problem | Java implementation for brute force method to calculate stock span values ; method to calculate stock span values ; Span value of first day is always 1 ; Calculate span value of remaining days by linearly checking previous days ; Initialize span value ; Traverse left while the next element on left is smaller than price [ i ] ; A utility function to print elements of array ; Driver program to test above functions ; Fill the span values in array S [ ] ; print the calculated span values
import java . util . Arrays ; class GFG { static void calculateSpan ( int price [ ] , int n , int S [ ] ) { S [ 0 ] = 1 ; for ( int i = 1 ; i < n ; i ++ ) { S [ i ] = 1 ; for ( int j = i - 1 ; ( j >= 0 ) && ( price [ i ] >= price [ j ] ) ; j -- ) S [ i ] ++ ; } } static void printArray ( int arr [ ] ) { System . out . print ( Arrays . toString ( arr ) ) ; } public static void main ( String [ ] args ) { int price [ ] = { 10 , 4 , 5 , 90 , 120 , 80 } ; int n = price . length ; int S [ ] = new int [ n ] ; calculateSpan ( price , n , S ) ; printArray ( S ) ; } }
The Stock Span Problem | Java linear time solution for stock span problem ; A stack based efficient method to calculate stock span values ; Create a stack and push index of first element to it ; Span value of first element is always 1 ; Calculate span values for rest of the elements ; Pop elements from stack while stack is not empty and top of stack is smaller than price [ i ] ; If stack becomes empty , then price [ i ] is greater than all elements on left of it , i . e . , price [ 0 ] , price [ 1 ] , . . price [ i - 1 ] . Else price [ i ] is greater than elements after top of stack ; Push this element to stack ; A utility function to print elements of array ; Driver method ; Fill the span values in array S [ ] ; print the calculated span values
import java . util . Stack ; import java . util . Arrays ; public class GFG { static void calculateSpan ( int price [ ] , int n , int S [ ] ) { Stack < Integer > st = new Stack < > ( ) ; st . push ( 0 ) ; S [ 0 ] = 1 ; for ( int i = 1 ; i < n ; i ++ ) { while ( ! st . empty ( ) && price [ st . peek ( ) ] <= price [ i ] ) st . pop ( ) ; S [ i ] = ( st . empty ( ) ) ? ( i + 1 ) : ( i - st . peek ( ) ) ; st . push ( i ) ; } } static void printArray ( int arr [ ] ) { System . out . print ( Arrays . toString ( arr ) ) ; } public static void main ( String [ ] args ) { int price [ ] = { 10 , 4 , 5 , 90 , 120 , 80 } ; int n = price . length ; int S [ ] = new int [ n ] ; calculateSpan ( price , n , S ) ; printArray ( S ) ; } }
The Stock Span Problem | Java program for a linear time solution for stock span problem without using stack ; An efficient method to calculate stock span values implementing the same idea without using stack ; Span value of first element is always 1 ; Calculate span values for rest of the elements ; A utility function to print elements of array ; Driver code ; Fill the span values in array S [ ] ; print the calculated span values
class GFG { static void calculateSpan ( int A [ ] , int n , int ans [ ] ) { ans [ 0 ] = 1 ; for ( int i = 1 ; i < n ; i ++ ) { int counter = 1 ; while ( ( i - counter ) >= 0 && A [ i ] >= A [ i - counter ] ) { counter += ans [ i - counter ] ; } ans [ i ] = counter ; } } static void printArray ( int arr [ ] , int n ) { for ( int i = 0 ; i < n ; i ++ ) System . out . print ( arr [ i ] + " ▁ " ) ; } public static void main ( String [ ] args ) { int price [ ] = { 10 , 4 , 5 , 90 , 120 , 80 } ; int n = price . length ; int S [ ] = new int [ n ] ; calculateSpan ( price , n , S ) ; printArray ( S , n ) ; } }
Next Greater Element | Simple Java program to print next greater elements in a given array ; prints element and NGE pair for all elements of arr [ ] of size n ; Driver Code
class Main { static void printNGE ( int arr [ ] , int n ) { int next , i , j ; for ( i = 0 ; i < n ; i ++ ) { next = - 1 ; for ( j = i + 1 ; j < n ; j ++ ) { if ( arr [ i ] < arr [ j ] ) { next = arr [ j ] ; break ; } } System . out . println ( arr [ i ] + " ▁ - - ▁ " + next ) ; } } public static void main ( String args [ ] ) { int arr [ ] = { 11 , 13 , 21 , 3 } ; int n = arr . length ; printNGE ( arr , n ) ; } }
Convert a Binary Tree into its Mirror Tree | Class containing left and right child of current node and key value ; Change a tree so that the roles of the left and right pointers are swapped at every node . So the tree ... 4 / \ 2 5 / \ 1 3 is changed to ... 4 / \ 5 2 / \ 3 1 ; do the subtrees ; swap the left and right pointers ; Helper function to test mirror ( ) . Given a binary search tree , print out its data elements in increasing sorted order . ; testing for example nodes ; print inorder traversal of the input tree ; convert tree to its mirror ; print inorder traversal of the minor tree
class Node { int data ; Node left , right ; public Node ( int item ) { data = item ; left = right = null ; } } class BinaryTree { Node root ; void mirror ( ) { root = mirror ( root ) ; } Node mirror ( Node node ) { if ( node == null ) return node ; Node left = mirror ( node . left ) ; Node right = mirror ( node . right ) ; node . left = right ; node . right = left ; return node ; } void inOrder ( ) { inOrder ( root ) ; } void inOrder ( Node node ) { if ( node == null ) return ; inOrder ( node . left ) ; System . out . print ( node . data + " ▁ " ) ; inOrder ( node . right ) ; } public static void main ( String args [ ] ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 1 ) ; tree . root . left = new Node ( 2 ) ; tree . root . right = new Node ( 3 ) ; tree . root . left . left = new Node ( 4 ) ; tree . root . left . right = new Node ( 5 ) ; System . out . println ( " Inorder ▁ traversal ▁ of ▁ input ▁ tree ▁ is ▁ : " ) ; tree . inOrder ( ) ; System . out . println ( " " ) ; tree . mirror ( ) ; System . out . println ( " Inorder ▁ traversal ▁ of ▁ binary ▁ tree ▁ is ▁ : ▁ " ) ; tree . inOrder ( ) ; } }
Number of NGEs to the right | Java program to print number of NGEs to the right ; array to store the next greater element index ; Use stack ; push the 0 th index to the stack ; traverse in the loop from 1 - nth index ; iterate till loop is empty ; get the topmost index in the stack ; if the current element is greater then the top index - th element , then this will be the next greatest index of the top index - th element ; initialize the cur index position 's  next greatest as index ; pop the cur index as its greater element has been found ; if not greater then break ; push the i index so that its next greatest can be found ; iterate for all other index left inside stack ; mark it as - 1 as no element in greater then it in right ; function to count the number of next greater numbers to the right ; initializes the next array as 0 ; calls the function to pre - calculate the next greatest element indexes ; if the i - th element has no next greater element to right ; Count of next greater numbers to right . ; answers all queries in O ( 1 ) ; returns the number of next greater elements to the right . ; driver code ; calls the function to count the number of greater elements to the right for every element . ; query 1 answered ; query 2 answered ; query 3 answered
import java . util . * ; class GFG { static void fillNext ( int next [ ] , int a [ ] , int n ) { Stack < Integer > s = new Stack < Integer > ( ) ; s . push ( 0 ) ; for ( int i = 1 ; i < n ; i ++ ) { while ( s . size ( ) > 0 ) { int cur = s . peek ( ) ; if ( a [ cur ] < a [ i ] ) { next [ cur ] = i ; s . pop ( ) ; } else break ; } s . push ( i ) ; } while ( s . size ( ) > 0 ) { int cur = s . peek ( ) ; next [ cur ] = - 1 ; s . pop ( ) ; } } static void count ( int a [ ] , int dp [ ] , int n ) { int next [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) next [ i ] = 0 ; fillNext ( next , a , n ) ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( next [ i ] == - 1 ) dp [ i ] = 0 ; else dp [ i ] = 1 + dp [ next [ i ] ] ; } } static int answerQuery ( int dp [ ] , int index ) { return dp [ index ] ; } public static void main ( String args [ ] ) { int a [ ] = { 3 , 4 , 2 , 7 , 5 , 8 , 10 , 6 } ; int n = a . length ; int dp [ ] = new int [ n ] ; count ( a , dp , n ) ; System . out . println ( answerQuery ( dp , 3 ) ) ; System . out . println ( answerQuery ( dp , 6 ) ) ; System . out . println ( answerQuery ( dp , 1 ) ) ; } }
Number of NGEs to the right |  ; use of stl stack in Java ; push the ( n - 1 ) th index to the stack ; traverse in reverse order ; if no element is greater than arr [ i ] the number of NGEs to right is 0 ; number of NGEs to right of arr [ i ] is one greater than the number of NGEs to right of higher number to its right ; reverse again because values are in reverse order ; returns the vector of number of next greater elements to the right of each index . ; Driver code ; query 1 answered ; query 2 answered ; query 3 answered
import java . util . * ; class GFG { static Vector < Integer > no_NGN ( int arr [ ] , int n ) { Vector < Integer > nxt = new Vector < > ( ) ; Stack < Integer > s = new Stack < > ( ) ; nxt . add ( 0 ) ; s . add ( n - 1 ) ; for ( int i = n - 2 ; i >= 0 ; i -- ) { while ( ! s . isEmpty ( ) && arr [ i ] >= arr [ s . peek ( ) ] ) s . pop ( ) ; if ( s . isEmpty ( ) ) nxt . add ( 0 ) ; else nxt . add ( nxt . get ( n - s . peek ( ) - 1 ) + 1 ) ; s . add ( i ) ; } Collections . reverse ( nxt ) ; return nxt ; } public static void main ( String [ ] args ) { int n = 8 ; int arr [ ] = { 3 , 4 , 2 , 7 , 5 , 8 , 10 , 6 } ; Vector < Integer > nxt = no_NGN ( arr , n ) ; System . out . print ( nxt . get ( 3 ) + "NEW_LINE"); System . out . print ( nxt . get ( 6 ) + "NEW_LINE"); System . out . print ( nxt . get ( 1 ) + "NEW_LINE"); } }
Maximum product of indexes of next greater on left and right | Java program to find the max LRproduct [ i ] among all i ; function to find just next greater element in left side ; checking if current element is greater than top ; on index of top store the current element index which is just greater than top element ; else push the current element in stack ; function to find just next greater element in right side ; checking if current element is greater than top ; on index of top store the current element index which is just greater than top element stored index should be start with 1 ; else push the current element in stack ; Function to find maximum LR product ; for each element storing the index of just greater element in left side ; for each element storing the index of just greater element in right side ; finding the max index product ; Driver code
import java . io . * ; import java . util . * ; class GFG { static int MAX = 1000 ; static int [ ] nextGreaterInLeft ( int [ ] a , int n ) { int [ ] left_index = new int [ MAX ] ; Stack < Integer > s = new Stack < Integer > ( ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) { while ( s . size ( ) != 0 && a [ i ] > a [ s . peek ( ) - 1 ] ) { int r = s . peek ( ) ; s . pop ( ) ; left_index [ r - 1 ] = i + 1 ; } s . push ( i + 1 ) ; } return left_index ; } static int [ ] nextGreaterInRight ( int [ ] a , int n ) { int [ ] right_index = new int [ MAX ] ; Stack < Integer > s = new Stack < Integer > ( ) ; for ( int i = 0 ; i < n ; ++ i ) { while ( s . size ( ) != 0 && a [ i ] > a [ s . peek ( ) - 1 ] ) { int r = s . peek ( ) ; s . pop ( ) ; right_index [ r - 1 ] = i + 1 ; } s . push ( i + 1 ) ; } return right_index ; } static int LRProduct ( int [ ] arr , int n ) { int [ ] left = nextGreaterInLeft ( arr , n ) ; int [ ] right = nextGreaterInRight ( arr , n ) ; int ans = - 1 ; for ( int i = 1 ; i <= n ; i ++ ) { ans = Math . max ( ans , left [ i ] * right [ i ] ) ; } return ans ; } public static void main ( String args [ ] ) { int [ ] arr = new int [ ] { 5 , 4 , 3 , 4 , 5 } ; int n = arr . length ; System . out . print ( LRProduct ( arr , n ) ) ; } }
The Celebrity Problem | Java program to find celebrity ; Max # of persons in the party ; Person with 2 is celebrity ; Returns - 1 if celebrity is not present . If present , returns id ( value from 0 to n - 1 ) . ; the graph needs not be constructed as the edges can be found by using knows function degree array ; ; query for all edges ; set the degrees ; find a person with indegree n - 1 and out degree 0 ; Driver code
import java . util . * ; class GFG { static final int N = 8 ; static int MATRIX [ ] [ ] = { { 0 , 0 , 1 , 0 } , { 0 , 0 , 1 , 0 } , { 0 , 0 , 0 , 0 } , { 0 , 0 , 1 , 0 } } ; static int knows ( int a , int b ) { return MATRIX [ a ] [ b ] ; } static int findCelebrity ( int n ) { int [ ] indegree = new int [ n ] ; int [ ] outdegree = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { int x = knows ( i , j ) ; outdegree [ i ] += x ; indegree [ j ] += x ; } } for ( int i = 0 ; i < n ; i ++ ) if ( indegree [ i ] == n - 1 && outdegree [ i ] == 0 ) return i ; return - 1 ; } public static void main ( String [ ] args ) { int n = 4 ; int id = findCelebrity ( n ) ; if ( id == - 1 ) System . out . print ( " No ▁ celebrity " ) ; else System . out . print ( " Celebrity ▁ ID ▁ " + id ) ; } }