Skip to content

Commit

Permalink
This file contains codeowners names whose approval is mandatory for m…
Browse files Browse the repository at this point in the history
…erging the PR in master.

Solution for Two Sum (#8)

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

Codeforces-Round944-div4-B
  • Loading branch information
Ritabrata1080 authored and Ritabrata Nag committed Jul 13, 2024
1 parent ab591a5 commit 7ee09e0
Showing 1 changed file with 30 additions and 0 deletions.
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 7ee09e0

Please sign in to comment.