-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
49ca7dc
commit c4520f5
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |