Skip to content

Commit

Permalink
Ritab dev codes (#9)
Browse files Browse the repository at this point in the history
* Codeforces round 944 Div4

* This file contains codeowners names whose approval is mandatory for merging the PR in master.

Solution for Two Sum (#8)

Co-authored-by: Trishit Chakraborty <[email protected]>

Codeforces-Round944-div4-B

---------

Co-authored-by: Ritabrata Nag <[email protected]>
  • Loading branch information
Ritabrata1080 and Ritabrata Nag authored Jul 14, 2024
1 parent 49ca7dc commit c4520f5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cf_round_944_div4_A.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import java.util.Scanner;

public class cf_round_944_div4_A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t --> 0){
int num1 = sc.nextInt();
int num2 = sc.nextInt();
System.out.print(Math.min(num1, num2)+ " ");
System.out.println(Math.max(num1, num2));
}
}
}

30 changes: 30 additions & 0 deletions cf_round_944_div4_B.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import java.util.*;

public class cf_round_944_div4_B {
public static void checkCase(String s){
Set<Character> set = new HashSet<>();
char c[] = s.toCharArray();
for(char c1 : c){
set.add(c1);
}
if(set.size() == 1){
System.out.println("NO");
}
else{
System.out.println("YES");
StringBuilder sb = new StringBuilder();
sb.append(s.substring(1, s.length()));
sb.append(String.valueOf(s.charAt(0)));
System.out.println(sb.toString());
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t --> 0){
String s = sc.next();
sc.nextLine();
checkCase(s);
}
}
}

0 comments on commit c4520f5

Please sign in to comment.