exec_outcome
stringclasses 1
value | code_uid
stringlengths 32
32
| file_name
stringclasses 111
values | prob_desc_created_at
stringlengths 10
10
| prob_desc_description
stringlengths 63
3.8k
| prob_desc_memory_limit
stringclasses 18
values | source_code
stringlengths 117
65.5k
| lang_cluster
stringclasses 1
value | prob_desc_sample_inputs
stringlengths 2
802
| prob_desc_time_limit
stringclasses 27
values | prob_desc_sample_outputs
stringlengths 2
796
| prob_desc_notes
stringlengths 4
3k
⌀ | lang
stringclasses 5
values | prob_desc_input_from
stringclasses 3
values | tags
listlengths 0
11
| src_uid
stringlengths 32
32
| prob_desc_input_spec
stringlengths 28
2.37k
⌀ | difficulty
int64 -1
3.5k
⌀ | prob_desc_output_spec
stringlengths 17
1.47k
⌀ | prob_desc_output_to
stringclasses 3
values | hidden_unit_tests
stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PASSED
|
3d8236c9efc1d186808ee853c2428500
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.io.*;
public class Hello {
public static void main(String[] args) throws Exception{
Scanner sc=new Scanner(System.in);
int tc=sc.nextInt();
for(int i=0;i<tc;i++)
{
int n=sc.nextInt();
char[] ch={'T','i','m','u','r'};
String s= sc.next();
char[] ch1=s.toCharArray();
Arrays.sort(ch1);
Arrays.sort(ch);
String s1=String.valueOf(ch);
String s2=String.valueOf(ch1);
if(s1.equals(s2)){
System.out.println("YES");
}else System.out.println("NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
b853b52b25646a42eca2e31590ff492d
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.*;
import java.util.*;
public class cf {
public static long gcd(long a, long b) {
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
public static boolean isok(long x, long h, long k) {
long sum = 0;
if (h > k) {
long t1 = h - k;
long t = t1 * k;
sum += (k * (k + 1)) / 2;
sum += t - (t1 * (t1 + 1) / 2);
} else {
sum += (h * (h + 1)) / 2;
}
if (sum < x) {
return true;
}
return false;
}
public static boolean binary_search(long[] a, long k) {
long low = 0;
long high = a.length - 1;
long mid = 0;
while (low <= high) {
mid = low + (high - low) / 2;
if (a[(int) mid] == k) {
return true;
} else if (a[(int) mid] < k) {
low = mid + 1;
} else {
high = mid - 1;
}
}
return false;
}
public static long lowerbound(long a[], long ddp) {
long low = 0;
long high = a.length;
long mid = 0;
while (low < high) {
mid = low + (high - low) / 2;
if (a[(int) mid] == ddp) {
return mid;
}
if (a[(int) mid] < ddp) {
low = mid + 1;
} else {
high = mid;
}
}
// if(low + 1 < a.length && a[(int)low + 1] <= ddp){
// low++;
// }
if (low == a.length && low != 0) {
low--;
return low;
}
if (a[(int) low] > ddp && low != 0) {
low--;
}
return low;
}
public static long upperbound(long a[], long ddp) {
long low = 0;
long high = a.length;
long mid = 0;
while (low < high) {
mid = low + (high - low) / 2;
if (a[(int) mid] <= ddp) {
low = mid + 1;
} else {
high = mid;
}
}
if (low == a.length) {
return a.length - 1;
}
return low;
}
// public static class pair implements Comparable<pair> {
// long w;
// long h;
// public pair(long w, long h) {
// this.w = w;
// this.h = h;
// }
// public int compareTo(pair b) {
// if (this.w != b.w)
// return (int) (this.w - b.w);
// else
// return (int) (this.h - b.h);
// }
// }
public static class pair {
long w;
long h;
public pair(long w, long h) {
this.w = w;
this.h = h;
}
}
public static class trinary {
long a;
long b;
long c;
public trinary(long a, long b, long c) {
this.a = a;
this.b = b;
this.c = c;
}
}
public static long lowerboundforpairs(pair a[], long pr) {
long low = 0;
long high = a.length;
long mid = 0;
while (low < high) {
mid = low + (high - low) / 2;
if (a[(int) mid].w <= pr) {
low = mid + 1;
} else {
high = mid;
}
}
// if(low + 1 < a.length && a[(int)low + 1] <= ddp){
// low++;
// }
// if(low == a.length && low != 0){
// low--;
// return low;
// }
// if(a[(int)low].w > pr && low != 0){
// low--;
// }
return low;
}
public static pair[] sortpair(pair[] a) {
Arrays.sort(a, new Comparator<pair>() {
public int compare(pair p1, pair p2) {
return (int) p1.w - (int) p2.w;
}
});
return a;
}
public static boolean ispalindrome(String s) {
long i = 0;
long j = s.length() - 1;
boolean is = false;
while (i < j) {
if (s.charAt((int) i) == s.charAt((int) j)) {
is = true;
i++;
j--;
} else {
is = false;
return is;
}
}
return is;
}
public static void sort(long[] arr) {
ArrayList<Long> a = new ArrayList<>();
for (long i : arr) {
a.add(i);
}
Collections.sort(a);
for (int i = 0; i < a.size(); i++) {
arr[i] = a.get(i);
}
}
public static void sortForObjecttypes(Long[] arr) {
ArrayList<Long> a = new ArrayList<>();
for (Long i : arr) {
a.add(i);
}
Collections.sort(a);
for (int i = 0; i < a.size(); i++) {
arr[i] = a.get(i);
}
}
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
float nextFloat() {
return Float.parseFloat(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
void readArr(int[] ar, int n) {
for (int i = 0; i < n; i++) {
ar[i] = nextInt();
}
}
}
public static void solve(FastReader sc, PrintWriter w) throws Exception {
int n = sc.nextInt();
String s = sc.nextLine();
boolean is = false;
Map<Character, Integer> hm = new HashMap<>();
hm.put('T', 0);
hm.put('i', 0);
hm.put('m', 0);
hm.put('u', 0);
hm.put('r', 0);
if (s.length() == 5) {
for (int i = 0; i < n; i++) {
if (hm.containsKey(s.charAt(i))) {
hm.put(s.charAt(i), hm.get(s.charAt(i)) + 1);
is = true;
} else {
is = false;
break;
}
}
if (is) {
for (Character c : hm.keySet()) {
if (hm.get(c) == 0 || hm.get(c) > 1) {
is = false;
break;
}
}
if (is) {
System.out.println("YES");
} else {
System.out.println("NO");
}
} else {
System.out.println("NO");
}
} else {
System.out.println("NO");
}
}
public static void main(String[] args) throws Exception {
FastReader sc = new FastReader();
PrintWriter w = new PrintWriter(System.out);
long o = sc.nextLong();
while (o > 0) {
solve(sc, w);
o--;
}
w.close();
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
b3faa041b1b40693c407366c4b1bfd4b
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.lang.*;
import java.io.*;
public class aCF
{
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new InputStreamReader(System.in));
}
String next(){
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
}catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try {
str = br.readLine();
}catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
public static void main(String args[] ) throws Exception {
// Write your code here
FastReader sc = new FastReader();
int t = sc.nextInt();
while(t-- != 0)
{
int n=sc.nextInt();
HashMap<Character,Integer> map=new HashMap<>();
String str=sc.next();
if(str.length()!=5) {
System.out.println("NO");
}
else {
char[] ch=new char[n];
ch=str.toCharArray();
char[] charr= {'T','i','m','u','r'};
for(char i:charr) {
map.put(i,1);
}
for(char k:ch) {
if(map.containsKey(k)) {
map.remove(k);
}
}
if(map.size()==0) {
System.out.println("YES");
}
else {
System.out.println("NO");
}
}
}
}
}
/*
Input
10
5
Timur
5
miurT
5
Trumi
5
mriTu
5
timur
4
Timr
6
Timuur
10
codeforces
10
TimurTimur
5
TIMUR
Participant's output
YES
YES
YES
YES
NO
NO
YES
NO
YES
NO
*/
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
306fff9698eed629aa018d9e4f999447
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Que1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- != 0){
int n = sc.nextInt();
String name = sc.next();
if(n < 5 || n > 5){
System.out.println("NO");
continue;
}
HashSet<Character> set = new HashSet<>();
set.add('T');
set.add('i');
set.add('m');
set.add('u');
set.add('r');
for(char ch: name.toCharArray()){
if(set.contains(ch)){
set.remove(ch);
}
}
System.out.println(set.isEmpty()?"Yes":"No");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
f626d4a20e96c863013eddeecb7e259e
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.HashSet;
import java.util.HashMap;
import java.util.Locale;
import java.util.Scanner;
public class new_1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
HashSet<Character> set = new HashSet<>();
set.add('T');
set.add('i');
set.add('m');
set.add('u');
set.add('r');
for (int i = 0; i < t; i++) {
int n = sc.nextInt();
String s = sc.next();
boolean flag = false;
HashSet<Character>set2 = new HashSet<>();
if(n!=5){
System.out.println("No");
continue;
}
for(int j=0;j<s.length();j++){
set2.add(s.charAt(j));
}
if(set2.size()!=5){
System.out.println("No");
continue;
}
for (int j = 0; j < s.length(); j++) {
if (!set.contains(s.charAt(j))) {
flag = true;
break;
}
}
if (flag) {
System.out.println("No");
} else {
System.out.println("Yes");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
5b280123b61eb801b1cb75340e46bec1
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
//package MyPackage;
import java.util.*;
import java.io.*;
public class B{
static class FastReader{
BufferedReader br;
StringTokenizer st;
public FastReader(){
br=new BufferedReader(new InputStreamReader(System.in));
}
String next(){
while(st==null || !st.hasMoreTokens()){
try {
st=new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt(){
return Integer.parseInt(next());
}
long nextLong(){
return Long.parseLong(next());
}
double nextDouble(){
return Double.parseDouble(next());
}
String nextLine(){
String str="";
try {
str=br.readLine().trim();
} catch (Exception e) {
e.printStackTrace();
}
return str;
}
}
static class FastWriter {
private final BufferedWriter bw;
public FastWriter() {
this.bw = new BufferedWriter(new OutputStreamWriter(System.out));
}
public void print(Object object) throws IOException {
bw.append("" + object);
}
public void println(Object object) throws IOException {
print(object);
bw.append("\n");
}
public void close() throws IOException {
bw.close();
}
}
static long gcd(long a, long b)
{
if (a == 0)
return b;
return gcd(b % a, a);
}
static long lcm(long a, long b)
{
return (a / gcd(a, b)) * b;
}
private static int func(int i, int a[], int prev, int k, Integer dp[][])
{
if(i == a.length) return 0;
// if(dp[i][prev] != null) return dp[i][prev];
int ans = (int) (1e9);
if(a[i] >= k - prev)
ans = Math.min(ans, func(i + 1, a, a[i], k, dp));
else
{
ans = Math.min(ans, k - prev - a[i] + func(i + 1, a, k - prev, k, dp));
a[i] = k - prev;
}
return dp[i][prev] = ans;
}
public static void main(String[] args) {
try {
FastReader in = new FastReader();
FastWriter out = new FastWriter();
StringBuilder sb = new StringBuilder();
int testCases=in.nextInt();
while(testCases-- > 0){
int n = in.nextInt();
String s = in.next();
int f = 1;
if(n != 5)
{
sb.append("NO\n");
continue;
}
Set<Character> set = new HashSet<>();
Map<Character, Integer> map = new HashMap<>();
String str = "Timur";
int cnt = 0;
boolean t = false;
for(char c: str.toCharArray())
{
set.add(Character.toLowerCase(c));
set.add(Character.toUpperCase(c));
}
for(char c: s.toCharArray())
{
if(!set.contains(c))
{
f = 0;
break;
}
if(Character.isUpperCase(c))
{
if(c == 'T') t = true;
cnt++;
}
map.put(c, map.getOrDefault(c, 0) + 1);
}
if(f == 1)
{
if(map.size() != 5 || cnt != 1 || !t) f = 0;
for(int i: map.values())
{
if(i != 1)
{
f = 0;
break;
}
}
}
if(f == 1) sb.append("YES\n");
else sb.append("NO\n");
}
out.println(sb);
out.close();
} catch (Exception e) {
System.out.println(e);
return;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
a7bab07b2c07ec6b05f11a1b239c838a
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
//1722A
import java.util.*;
public class SpellCheck {
public static void main(String[] args) {
// TODO Auto-generated method stub
int n;
String s;
Scanner scan = new Scanner(System.in);
int nbr = scan.nextInt();
String[] res = new String[nbr];
for(int i=0;i<nbr;i++) {
n = scan.nextInt();
s = scan.next();
if(n==5) {
if(s.contains("T") && s.contains("i") && s.contains("m") && s.contains("u") && s.contains("r")) {
res[i]="YES";
}
else {
res[i]="NO";
}
}
else {
res[i]="NO";
}
}
for(int i=0;i<nbr;i++) {
System.out.println(res[i]);
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
462f92564043ad4870db4292aacb2d71
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] args)throws Exception{
BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(b.readLine());
while(t-->0){
int n = Integer.parseInt(b.readLine());
String s = b.readLine();
if(n==5){
if(s.contains("T") && s.contains("i") && s.contains("m") && s.contains("u") && s.contains("r")){
System.out.println("Yes");
}else{
System.out.println("No");
}
}else{
System.out.println("No");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
3c2e4140d7498ca12a196dc653c0abd3
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;
public class SpellCheck{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
long t=sc.nextLong();
for(long i=0;i<t;i++){
int n=sc.nextInt();
String s=sc.next();
int c=0,c1=0,c2=0,c3=0,c4=0;
for(int j=0;j<s.length();j++)
{
if(s.charAt(j)=='T') {c++;}
else if(s.charAt(j)=='i'){
c1++;
}
else if(s.charAt(j)=='m'){
c2++;
}
else if(s.charAt(j)=='u'){
c3++;
}
else if(s.charAt(j)=='r'){
c4++;
}
}
if(s.length()==5&&c==1&&c1==1&&c2==1&&c3==1&&c4==1){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
eff73c0c67b32e9414f54cd79bea5ec8
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Arrays;
import java.util.Scanner;
public class one817 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int i = 0; i <T; i++){
int N = sc.nextInt();
boolean b = false;
String input = sc.next();
if(input.contains("T")&&input.contains("i")&&input.contains("m")&&input.contains("u")&&input.contains("r")&&input.length()==5){
b = true;
}
if(b){
System.out.println("Yes");
}
else{
System.out.println("No");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
32c60d52f09568b83bf1cfec29311918
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.io.*;
public final class Solution{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
String s;
int t,n;
t=sc.nextInt();
for(int p=0;p<t;p++){
n=sc.nextInt();
s=sc.next();
HashMap<Character,Integer> map=new HashMap<>();
if(n<5 || n>5){
System.out.println("NO");
}
else{
for(int i=0;i<n;i++){
if(map.containsKey(s.charAt(i))){
map.put(s.charAt(i),map.get(s.charAt(i))+1);
}
else{
map.put(s.charAt(i),1);
}
}
if((map.containsKey('T') && map.get('T')==1) &&
(map.containsKey('i') && map.get('i')==1) &&
(map.containsKey('m') && map.get('m')==1) &&
(map.containsKey('u') && map.get('u')==1) &&
(map.containsKey('r') && map.get('r')==1)){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
e93cf61a70c38e73e42a507cfdd9ddf2
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Main
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int n=sc.nextInt();
String s=sc.next();
String s1="Timur";
char a[]=s1.toCharArray();
Arrays.sort(a);
char b[]=s.toCharArray();
Arrays.sort(b);
if(n==5)
{
if(Arrays.equals(a,b))
System.out.println("yes");
else
System.out.println("no");
}
else
System.out.println("no");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
195684a0caa43017e53e9f06fb078856
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.io.*;
public class Main {
static FastReader sc = new FastReader();
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
int T = sc.nextInt();
while (T-- > 0) {
solve();
}
out.close();
}
static void solve() {
int n = sc.nextInt();
String s = "Timru";
char a[] = sc.nextLine().toCharArray();
Arrays.sort(a);
String res = new String(a);
if(s.equals(res))
System.out.println("YES");
else
System.out.println("NO");
}
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
try {
br = new BufferedReader(new FileReader("input.txt"));
PrintStream out = new PrintStream(new FileOutputStream("output.txt"));
System.setOut(out);
} catch (Exception e) {
br = new BufferedReader(new InputStreamReader(System.in));
}
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
bd219cdd327b890fac89ef62772507de
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;
import java.util.*;
public class distict {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t>0) {
int n=sc.nextInt();
String str=sc.next();
char tempArray[] = str.toCharArray();
Arrays.sort(tempArray);
String ans=new String(tempArray);
if(ans.equals("Timru"))
System.out.println("Yes");
else
System.out.println("No");
t--;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
b23701e795ce9d1accfb9a7ce8a50119
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.io.*;
public class A {
static String x="Timur";
public static void main(String[] args) throws Exception {
FastScanner sc=new FastScanner();
int t=sc.nextInt();
outer:
while(t-->0) {
Map<Character,Integer>map=new HashMap<>();
map.put('T',1); map.put('i',1); map.put('m',1);
map.put('u',1); map.put('r',1);
int n=sc.nextInt();
String s=sc.next();
if(s.length()!=5) {
System.out.println("No");
continue outer;
}
for(char ch:s.toCharArray()) {
if(map.get(ch)!=null) map.remove(ch);
else {
System.out.println("No");
continue outer;
}
}
System.out.println("Yes");
}
}
}
class FastScanner {
BufferedReader brd;
StringTokenizer stz;
public FastScanner() {
brd=new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while(stz==null ||!stz.hasMoreElements()) {
try {
stz=new StringTokenizer(brd.readLine());
}
catch(IOException e) {
e.printStackTrace();
}
}
return stz.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str="";
try {
str=brd.readLine();
}
catch(IOException e) {
e.printStackTrace();
}
return str;
}
boolean hasNext() {
if (stz!=null && stz.hasMoreTokens()) {
return true;
}
String str="";
try {
brd.mark(1000);
str=brd.readLine();
if (str==null) {
return false;
}
brd.reset();
} catch (IOException e) {
return false;
}
return true;
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
2a35b8770ec16048bc7ed3c1ecaf6b62
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;
public class Main {
public static void main(String[] args)
{
//System.out.println("Hello world!");
Scanner sc = new Scanner(System.in);
int testCase = sc.nextInt();
for (int i=0; i< testCase; i++)
{
int length = sc.nextInt();
String name = sc.next();
if (length == 5)
{
if (name.contains("T") && name.contains("i") && name.contains("m") && name.contains("u") && name.contains("r"))
{
System.out.println("YES");
}
else
{
System.out.println("NO");
}
}
else
{
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
1000f46c091ce969dd187dfdb1ce7d1b
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class cf {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int testcase = scan.nextInt();
// int testcase = 1;
for(int v = 0; v < testcase; v++){
int n = scan.nextInt();
String s = scan.next();
if(n != 5){
System.out.println("NO");
}
else{
HashMap<Character, Integer> set = new HashMap<>();
set.put('T', 1);
set.put('i', 1);
set.put('m', 1);
set.put('u', 1);
set.put('r', 1);
boolean bool = true;
for(int i = 0; i < 5; i++){
if(set.containsKey(s.charAt(i)) && set.get(s.charAt(i)) > 0){
set.put(s.charAt(i), set.get(s.charAt(i)) - 1);
}
else{
bool = false;
break;
}
}
if(bool){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
9e4ea9257e057890276069d7aa73fc35
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Main
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=Integer.parseInt(sc.next());
while(t-->0)
{
int n=Integer.parseInt(sc.next());
String s=sc.next();
int i,c1,c2,c3,c4,c5;
c1=c2=c3=c4=c5=0;
char ch;
for(i=0;i<n;i++)
{
ch=s.charAt(i);
if(ch=='m')
{
c1++;
}
else if(ch=='i')
{
c2++;
}
else if(ch=='u')
{
c3++;
}
else if(ch=='r')
{
c4++;
}
else if(ch=='T')
{
c5++;
}
}
if(c1==1 && c2==1 && c3==1 && c4==1 && c5==1&&(c1+c2+c3+c4+c5==s.length()))
{
System.out.println("YES");
}
else
{
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
1d628722be2be59c5cbe069df7e6374f
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.*;
public class Timur1 {
public static void main(String[] args) throws Exception{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(reader.readLine());
for (int i = 0; i < t; i++){
int n = Integer.parseInt(reader.readLine());
String s = reader.readLine();
if (n != 5){
System.out.println("NO");
}
else{
if (isCorrect(s)){
System.out.println("YES");
}
else System.out.println("NO");
}
}
}
public static boolean doesContain(char ch, String str){
for (int i = 0; i < str.length(); i++){
if (str.charAt(i) == ch){
return true;
}
}
return false;
}
public static boolean isCorrect(String s){
String str = "Timur";
for (int i = 0; i < 5; i++){
Character c = s.charAt(i);
if (doesContain(c,str)){
str = str.replace(c.toString(),"");
}
else return false;
}
return true;
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
5da48f5c4e4f3004c68cd820cbc42b95
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Main{
public static String sortString(String inputString)
{
char tempArray[] = inputString.toCharArray();
Arrays.sort(tempArray);
return new String(tempArray);
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
String a="Timur";
String b=sortString(a);
while(T>0)
{
int n=sc.nextInt();
String str=sc.next();
String c=sortString(str);
if(c.equals(b)){
System.out.println("YES");
}
else{
System.out.println("NO");
}
T--;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
ca1ed17e14df603bc1f9de47f0c43614
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class MyClass {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int p=sc.nextInt();
while(p-->0)
{
int n=sc.nextInt();
String s=sc.next();
int t=0,i=0,m=0,u=0,r=0;
for(int j=0;j<n;j++)
{
if(s.charAt(j)=='T')
t++;
if(s.charAt(j)=='i')
i++;
if(s.charAt(j)=='m')
m++;
if(s.charAt(j)=='u')
u++;
if(s.charAt(j)=='r')
r++;
}
if(t==1 && i==1&& m==1 && u==1 &&r==1 &&s.length()==5)
System.out.println("YES");
else
System.out.println("NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
ee15b61d622877b80cbf6ae50428e826
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;
public class JavaApplication58 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
String s=sc.next();
if(n!=5){
System.out.println("NO");
}
else{
if(s.contains("T")&&s.contains("i")&&s.contains("m")&&s.contains("u")&&s.contains("r")){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
35c5ba8eb5ccdbd1eb569152bb8dd18f
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;
import java.util.stream.Collectors;
public class JavaApplication59 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int tc = 0; tc < t; ++tc) {
sc.nextInt();
String s = sc.next();
System.out.println(solve(s) ? "YES" : "NO");
}
sc.close();
}
static boolean solve(String s) {
return buildKey(s).equals(buildKey("Timur"));
}
static String buildKey(String str) {
return str.chars()
.sorted()
.mapToObj(c -> String.valueOf((char) c))
.collect(Collectors.joining());
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
d4b3f2ffda347505c38de1e2a1d6e960
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
public class Main {
void solve(Scanner in, PrintWriter out) {
int t = in.nextInt();
String [] tim = {"T", "i", "m", "u", "r"};
for (int i = 0; i < t; ++i) {
int n = in.nextInt();
String s = in.next();
if (n != 5) {
out.println("NO");
} else {
boolean fl = true;
for (int j = 0; j < tim.length; j++) {
if (!s.contains(tim[j])) {
out.println("NO");
fl = false;
break;
}
}
if (fl) {
out.println("YES");
}
}
}
}
void run() {
try (
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out)) {
solve(in, out);
}
}
public static void main(String[] args) throws IOException {
new Main().run();
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
123b1d1a6c18e1ee624cf6a03b2c1a28
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.*;
import java.util.*;
public class Solve {
static final int MOD = 1000000007;
static int count = 0;
public static void main(String[] args) {
Reader in = new Reader();
PrintWriter out = new PrintWriter(System.out);
int t = in.readInt();
while (t-- > 0)
solve(in, out);
out.close();
}
private static void solve(Reader in, PrintWriter out) {
int n = in.readInt();
String s = in.readLine();
if (n == 5 && s.contains("T") && s.contains("i") && s.contains("m") && s.contains("u") && s.contains("r")) {
out.println("yes");
} else out.println("no");
}
private static int lowerBound(int[] nums, int target) {
int low = 0;
int high = nums.length - 1;
int ans = -1;
while (low <= high) {
int mid = low + (high - low) / 2;
if (nums[mid] == target) {
ans = mid;
high = mid - 1;
} else {
if (nums[mid] > target) {
high = mid - 1;
} else {
low = mid + 1;
}
}
}
return ans;
}
private static int upperBound(int[] nums, int target) {
int low = 0;
int high = nums.length - 1;
int ans = -1;
while (low <= high) {
int mid = low + (high - low) / 2;
if (nums[mid] == target) {
ans = mid;
low = mid + 1;
} else {
if (nums[mid] > target) {
high = mid - 1;
} else {
low = mid + 1;
}
}
}
return ans;
}
private static long power(long n, long p, long m) {
long result = 1;
while (p > 0) {
if (p % 2 == 1)
result = (result * n) % m;
n = (n * n) % m;
p >>= 1;
}
return result;
}
private int gcd(int a, int b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
private static void sort(int a[], int n) {
List<Integer> list = new ArrayList<>();
for (int i : a)
list.add(i);
Collections.sort(list);
for (int i = 0; i < n; i++)
a[i] = list.get(i);
}
private static void sieve(int n) {
boolean[] prime = new boolean[n];
for (int i = 0; i < n; i++)
prime[i] = true;
for (int i = 2; i * i < n; i++) {
if (prime[i]) {
for (int j = i * i; j < n; j += i)
prime[j] = false;
}
}
for (int i = 2; i < prime.length; i++) {
if (prime[i])
System.out.print(i + " ");
}
}
private static void segmentedSieve(int low, int high) {
int sqrt = (int) Math.sqrt(high);
int[] prime = new int[sqrt + 1];
boolean[] arr = new boolean[sqrt + 1];
for (int i = 0; i <= sqrt; i++)
arr[i] = true;
int k = 0;
for (int i = 2; i <= sqrt; i++) { // generate all prime numbers till square root of high
if (arr[i]) {
prime[k] = i;
k++;
for (int j = i * i; j <= sqrt; j += i)
arr[j] = false;
}
}
// System.out.println(Arrays.toString(prime));
int diff = high - low + 1; // arr size of required length
arr = new boolean[diff];
for (int i = 0; i < diff; i++)
arr[i] = true;
for (int i = 0; i < k; i++) { // mark false to multiple of prime numbers in the range of low to high
int div = (low / prime[i]) * prime[i]; // It gives multiple of prime[i] nearest to low
if (div < low || div == prime[i])
div += prime[i];
for (int j = div; j <= high; j += prime[i]) {
if (j != prime[i])
arr[j - low] = false;
}
}
for (int i = 0; i < diff; i++) { // print prime numbers in the given segment
if (arr[i] && (i + low) != 1) {
System.out.print(i + low + " ");
}
}
System.out.println();
}
static class Pair implements Comparable<Pair> {
int a;
int b;
public Pair(int a, int b) {
this.a = a;
this.b = b;
}
@Override
public int compareTo(Pair o) {
if (this.a > o.a)
return this.a - o.a;
else if (this.a < o.a)
return this.b - o.b;
else
return 0;
}
}
static class Reader {
BufferedReader br;
StringTokenizer st;
public Reader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String read() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int readInt() {
return Integer.parseInt(read());
}
String readLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
long readLong() {
return Long.parseLong(read());
}
double readDouble() {
return Double.parseDouble(read());
}
int[] readIntArray(int n) {
int[] arr = new int[n];
for (int i = 0; i < n; i++)
arr[i] = readInt();
return arr;
}
long[] readLongArray(int n) {
long[] arr = new long[n];
for (int i = 0; i < n; i++)
arr[i] = readLong();
return arr;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
ab924b9b97e40a812a56287bed045059
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Main{
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
HashMap<Character,Integer> mp = new HashMap<>();
mp.put('T',1);
mp.put('i',1);
mp.put('m',1);
mp.put('u',1);
mp.put('r',1);
while(t>0){
int n = sc.nextInt();
String s = sc.next();
HashMap<Character,Integer> m = new HashMap<>();
m.putAll(mp);
boolean flag=false;
for(int i=0;i<n;i++){
if(!m.containsKey(s.charAt(i))){
flag=true;
System.out.println("NO");
break;
}
else{
m.remove(s.charAt(i));
}
}
if(flag==false && m.isEmpty()){
System.out.println("YES");
}
if(flag==false && !m.isEmpty())
System.out.println("NO");
t--;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
6532ea6e41dee28181472dbd9e044622
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class ans1 {
public static class TreeNode{
int num;
char col;
TreeNode(int num,char col){
this.num = num;
this.col = col;
}
}
public static class Pair{
TreeNode root;
ArrayList<TreeNode> children;
Pair(TreeNode root,ArrayList<TreeNode> children){
this.root = root;
this.children = children;
}
}
public static class Pairs{
int b;
int w;
Pairs(int b,int w){
this.b = b;
this.w = w;
}
}
static int gbmin;
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int l = sc.nextInt();
String s = sc.next();
char [] arr = s.toCharArray();
Arrays.sort(arr);
String checked = "";
for(char c:arr)checked+=c;
// System.out.println(checked);
if(checked.equals("Timru"))System.out.println("YES");
else System.out.println("NO");
}
}
public static void reverseArray(int []arr){
int i=0,j=arr.length-1;
while(i<j){
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
i++;
j--;
}
}
public static int CeilIndex(int A[], int l, int r, int key){
while (r - l > 1) {
int m = l + (r - l) / 2;
if (A[m] >= key)
r = m;
else
l = m;
}
return r;
}
static int LongestIncreasingSubsequenceLength(int A[], int size)
{
// Add boundary case, when array size is one
int[] tailTable = new int[size];
int len; // always points empty slot
tailTable[0] = A[0];
len = 1;
for (int i = 1; i < size; i++) {
if (A[i] < tailTable[0])
// new smallest value
tailTable[0] = A[i];
else if (A[i] > tailTable[len - 1])
// A[i] wants to extend largest subsequence
tailTable[len++] = A[i];
else
// A[i] wants to be current end candidate of an existing
// subsequence. It will replace ceil value in tailTable
tailTable[CeilIndex(tailTable, -1, len - 1, A[i])] = A[i];
}
return len;
}
// public static boolean recur(int [][] m,ArrayList<Pair> check){
// boolean reached = false;
// for(int k=0;k<check.size();k++){
// int i = check.get(k).i;
// int j = check.get(k).j;
// if(i==0 && j==0)reached = true;
// // System.out.println("i" + i + "j" + j);
// if(!boundary(m, i, j))return false;
// }
// if(reached)return true;
// ArrayList<Pair> temp = new ArrayList<>();
// for(int k=0;k<check.size();k++){
// int i = check.get(k).i;
// int j = check.get(k).j-1;
// Pair ob1 = new temp().new Pair(i,j);
// temp.add(ob1);
// }
// boolean left = recur(m,temp);
// if(left)return true;
// temp = new ArrayList<>();
// for(int k=0;k<check.size();k++){
// int i = check.get(k).i-1;
// int j = check.get(k).j;
// Pair ob1 = new temp().new Pair(i,j);
// temp.add(ob1);
// }
// boolean up = recur(m,temp);
// if(up || left)return true;
// return false;
// }
// public static boolean boundary(int [][] m,int i,int j){
// if(i<0 || j<0 ||i>=m.length || j>m[0].length)return false;
// return true;
// }
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
7d1f4c993fa004d6f5a49147d865babc
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Spell_Check
{
public static void main(String args[])
{
Scanner Sc=new Scanner(System.in);
int t=Sc.nextInt();
while(t!=0)
{
int n=Sc.nextInt();
String s=Sc.next();
String Str="Timru";
char[] ch=s.toCharArray();
Arrays.sort(ch);
s=new String(ch);
if(s.equals(Str))
{
System.out.println("YES");
}
else
{
System.out.println("NO");
}
t--;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
862d561ab6383d4384461718369a18e3
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int i=0; i<t; i++){
int n = sc.nextInt();
String s = sc.next();
HashMap<Character, Integer> map = new HashMap<>();
map.put('T', 1);
map.put('i', 1);
map.put('m', 1);
map.put('u', 1);
map.put('r', 1);
if (s.length()!=5){
System.out.println("NO");
continue;
}
for(int j=0; j<5; j++){
if(!map.containsKey(s.charAt(j)))
map.put(s.charAt(j), 1);
else
map.remove(s.charAt(j));
}
if(map.size()==0)
System.out.println("YES");
else
System.out.println("NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
bfa3178d3ae8030a827f87678402a2e7
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class q1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner key=new Scanner(System.in);
int t=key.nextInt();
for(int j=0;j<t;j++) {
int n=key.nextInt();
int a=0,b=0,c=0,d=0,e=0,f=0;
key.nextLine();
String str=key.nextLine();
for(int i=0;i<n;i++) {
if(str.charAt(i)=='T'){
a++;
}
else if(str.charAt(i)=='i'){
b++;
}
else if(str.charAt(i)=='m'){
c++;
}
else if(str.charAt(i)=='u') {
d++;
}
else if(str.charAt(i)=='r') {
e++;
}else {
f++;
}
}
if(a==1 && b==1 && c==1 && d==1 && e==1 && f==0) {
System.out.println("yes");
}else {
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
9518b72b9da24963872c2536b9342cf4
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Timur {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int tc=sc.nextInt();
String tim="Timru";
for(int t=0;t<tc;t+=1){
int l=sc.nextInt();
String ip=sc.next();
if(l!=5){
System.out.println("NO");
}
else{
char[] c=ip.toCharArray();
Arrays.sort(c);
String op="";
for(int i=0;i<5;i++){
op+=c[i];
}
if(op.equals(tim)){
System.out.println("YES");
}
else
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
84a286ad78a207ecad9d0c48d9c3ca96
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class TestC {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(
new InputStreamReader(System.in));
}
String next()
{
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
}
catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try {
if(st.hasMoreTokens()){
str = st.nextToken("\n");
}
else{
str = br.readLine();
}
}
catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
public static void main(String[] args)
{
FastReader sc = new FastReader();
/*int n = s.nextInt();
int k = s.nextInt();
int count = 0;
while (n-- > 0) {
int x = s.nextInt();
if (x % k == 0)
count++;
}
System.out.println(count);*/
int tc=sc.nextInt();
String tim="Timru";
for(int t=0;t<tc;t++){
int l=sc.nextInt();
String ip=sc.next();
if(l!=5){
System.out.println("NO");
}
else{
char[] c=ip.toCharArray();
Arrays.sort(c);
String op="";
for(int i=0;i<5;i++){
op+=c[i];
}
if(op.equals(tim)){
System.out.println("YES");
}
else
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
e2fc57ae2da2b3ee1b738cb28d19a673
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int z=0;z<t;z++){
int n = sc.nextInt();
String s = sc.next();
if(n==5 && s.contains("T")&&s.contains("i")&&s.contains("m")&&s.contains("u")&&s.contains("r"))
System.out.println("YES");
else
System.out.println("NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
e7b75baf56a9ee07b267a698aa7ec7cb
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
/* package codeChef; // don't place package name! */
// algo_messiah23 , NIT RKL ...
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
import static java.lang.System.*;
import java.util.stream.IntStream;
import java.util.Map.Entry;
/* Name of the class has to be "Main" only if the class is public. */
public class CodeForces {
static PrintWriter out = new PrintWriter((System.out));
static FastReader in = new FastReader();
static int INF = Integer.MAX_VALUE;
static int NINF = Integer.MIN_VALUE;
public static void main(String[] args) throws java.lang.Exception {
// your code goes here
int t = i();
while (t-- > 0)
algo_messiah23();
out.close();
}
public static void algo_messiah23() {
int n = i();
String s = is();
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int e = 0;
int g = 0;
for (int i = 0; i < n; i++) {
char ch = s.charAt(i);
if (ch == 'T')
a++;
else if (ch == 'i')
b++;
else if (ch == 'm')
c++;
else if (ch == 'u')
d++;
else if (ch == 'r')
e++;
else
g++;
}
if (a == 1 && b == 1 && c == 1 && d == 1 && e == 1 && g == 0)
out.println("YES");
else
out.println("NO");
}
static String rev(String s) {
StringBuilder st = new StringBuilder(s);
st.reverse();
String ans = st.toString();
return ans;
}
static int[] input(int N) {
int[] A = new int[N];
for (int i = 0; i < N; i++)
A[i] = in.nextInt();
return A;
}
public static void print(int[] arr) {
int n = arr.length;
for (int i = 0; i < n; i++) {
out.print(arr[i] + " ");
}
out.println();
}
public static void sort(int[] arr) {
ArrayList<Integer> ls = new ArrayList<>();
for (int x : arr) {
ls.add(x);
}
Collections.sort(ls);
for (int i = 0; i < arr.length; i++) {
arr[i] = ls.get(i);
}
}
public static void reverse(int[] arr) {
int n = arr.length;
for (int i = 0; i < n / 2; i++) {
int temp = arr[i];
arr[i] = arr[n - 1 - i];
arr[n - 1 - i] = temp;
}
}
public static void reverse(long[] arr) {
int n = arr.length;
for (int i = 0; i < n / 2; i++) {
long temp = arr[i];
arr[i] = arr[n - 1 - i];
arr[n - 1 - i] = temp;
}
}
public static void print(ArrayList<Integer> arr) {
int n = arr.size();
for (int i = 0; i < n; i++) {
out.print(arr.get(i) + " ");
}
out.println();
}
static int i() {
return in.nextInt();
}
static long l() {
return in.nextLong();
}
static char ich() {
return in.next().charAt(0);
}
static String is() {
return in.next();
}
static String isl() {
return in.nextLine();
}
public static int max(int[] arr) {
int max = -1;
int n = arr.length;
for (int i = 0; i < n; i++)
max = Math.max(max, arr[i]);
return max;
}
public static int min(int[] arr) {
int min = INF;
int n = arr.length;
for (int i = 0; i < n; i++)
min = Math.min(min, arr[i]);
return min;
}
public static int gcd(int x, int y) {
if (y == 0) {
return x;
}
return gcd(y, x % y);
}
}
class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
560e21a9acf12b52eaccb12770e5edbf
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Main{
public static void main(String[] args) throws Exception{
Scanner sc=new Scanner(System.in);
int T=sc.nextInt();
for(int t=0;t<T;t++)
{
int n=sc.nextInt();
String s=sc.next();
if(n==5 && s.indexOf('T')!=-1
&&s.indexOf('i')!=-1 &&s.indexOf('m')!=-1
&&s.indexOf('u')!=-1 &&s.indexOf('r')!=-1)
System.out.println("YES");
else
System.out.println("No");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
930554841ae0115e081e4917e850146e
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
String m = "Timur";
char[] ch = m.toCharArray();
Arrays.sort(ch);
m = String.copyValueOf(ch);
while(t!=0){
int k = sc.nextInt();
String str = sc.next();
char[] ans = str.toCharArray();
Arrays.sort(ans);
str = String.copyValueOf(ans);
HashSet<String> n = new HashSet<>();
n.add(m);
n.add(str);
if(n.size()==1)
System.out.println("YES");
else
System.out.println("NO");
t--;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
2af3ccb6232ce8ea23df63bc14c9dc47
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream;
OutputStream outputStream;
try {
inputStream = new FileInputStream("input.txt");
outputStream = new FileOutputStream("output.txt");
} catch (Exception e) {
inputStream = System.in;
outputStream = System.out;
}
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
solve(in, out);
out.close();
}
public static void solve(InputReader in, PrintWriter out) {
int t = in.nextInt();
int timurSize = 5;
String timur = "Timur";
for (int i = 0; i < t; i++) {
int n = in.nextInt();
String s = in.next();
if (n != timurSize) {
out.println("NO");
continue;
}
char[] sWords = s.toCharArray();
boolean flag = false;
int[] arr = new int[]{0, 0, 0, 0, 0};
for (char word : sWords) {
if (timur.indexOf(word) == -1 || arr[timur.indexOf(word)] == 1) {
out.println("NO");
flag = true;
break;
} else {
arr[timur.indexOf(word)]++;
}
}
if (!flag) {
out.println("YES");
}
}
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
7b84c6b7cb23cc98bd7c9b523a668878
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
/* Name of the class has to be "Main" only if the class is public. */
public class A
{
public static void main (String[] args) throws Exception
{
// your code goes here
FastScanner sc= new FastScanner();
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt();
char s[] = sc.next().trim().toCharArray();
Arrays.sort(s);
char b[] = "Timur".toCharArray();
Arrays.sort(b);
if(s.length!=b.length){
System.out.println("NO");
}else {
boolean flag = true;
for (int i = 0; i < n; i++) {
if (s[i] != b[i]) {
flag = false;
break;
}
}
if(flag){
System.out.println("YES");
}else{
System.out.println("NO");
}
}
}
}
public static boolean isPrime(long n)
{
if(n < 2) return false;
if(n == 2 || n == 3) return true;
if(n%2 == 0 || n%3 == 0) return false;
long sqrtN = (long)Math.sqrt(n)+1;
for(long i = 6L; i <= sqrtN; i += 6) {
if(n%(i-1) == 0 || n%(i+1) == 0) return false;
}
return true;
}
public static long gcd(long a, long b)
{
if(a > b)
a = (a+b)-(b=a);
if(a == 0L)
return b;
return gcd(b%a, a);
}
public static ArrayList<Integer> findDiv(int N)
{
//gens all divisors of N
ArrayList<Integer> ls1 = new ArrayList<Integer>();
ArrayList<Integer> ls2 = new ArrayList<Integer>();
for(int i=1; i <= (int)(Math.sqrt(N)+0.00000001); i++)
if(N%i == 0)
{
ls1.add(i);
ls2.add(N/i);
}
Collections.reverse(ls2);
for(int b: ls2)
if(b != ls1.get(ls1.size()-1))
ls1.add(b);
return ls1;
}
public static void sort(int[] arr)
{
//because Arrays.sort() uses quicksort which is dumb
//Collections.sort() uses merge sort
ArrayList<Integer> ls = new ArrayList<Integer>();
for(int x: arr)
ls.add(x);
Collections.sort(ls);
for(int i=0; i < arr.length; i++)
arr[i] = ls.get(i);
}
public static long power(long x, long y, long p)
{
//0^0 = 1
long res = 1L;
x = x%p;
while(y > 0)
{
if((y&1)==1)
res = (res*x)%p;
y >>= 1;
x = (x*x)%p;
}
return res;
}
static class FastScanner
{
//I don't understand how this works lmao
private int BS = 1 << 16;
private char NC = (char) 0;
private byte[] buf = new byte[BS];
private int bId = 0, size = 0;
private char c = NC;
private double cnt = 1;
private BufferedInputStream in;
public FastScanner() {
in = new BufferedInputStream(System.in, BS);
}
public FastScanner(String s) {
try {
in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
} catch (Exception e) {
in = new BufferedInputStream(System.in, BS);
}
}
private char getChar() {
while (bId == size) {
try {
size = in.read(buf);
} catch (Exception e) {
return NC;
}
if (size == -1) return NC;
bId = 0;
}
return (char) buf[bId++];
}
public int nextInt() {
return (int) nextLong();
}
public int[] nextInts(int N) {
int[] res = new int[N];
for (int i = 0; i < N; i++) {
res[i] = (int) nextLong();
}
return res;
}
public long[] nextLongs(int N) {
long[] res = new long[N];
for (int i = 0; i < N; i++) {
res[i] = nextLong();
}
return res;
}
public long nextLong() {
cnt = 1;
boolean neg = false;
if (c == NC) c = getChar();
for (; (c < '0' || c > '9'); c = getChar()) {
if (c == '-') neg = true;
}
long res = 0;
for (; c >= '0' && c <= '9'; c = getChar()) {
res = (res << 3) + (res << 1) + c - '0';
cnt *= 10;
}
return neg ? -res : res;
}
public double nextDouble() {
double cur = nextLong();
return c != '.' ? cur : cur + nextLong() / cnt;
}
public double[] nextDoubles(int N) {
double[] res = new double[N];
for (int i = 0; i < N; i++) {
res[i] = nextDouble();
}
return res;
}
public String next() {
StringBuilder res = new StringBuilder();
while (c <= 32) c = getChar();
while (c > 32) {
res.append(c);
c = getChar();
}
return res.toString();
}
public String nextLine() {
StringBuilder res = new StringBuilder();
while (c <= 32) c = getChar();
while (c != '\n') {
res.append(c);
c = getChar();
}
return res.toString();
}
public boolean hasNext() {
if (c > 32) return true;
while (true) {
c = getChar();
if (c == NC) return false;
else if (c > 32) return true;
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
0b14d1da5583923a462441390b8468fe
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.*;
import java.util.*;
public class solution2{
public static void main(String[]args){
Scanner in=new Scanner(System.in);
int t=in.nextInt();
String s="Timur";
HashSet<Character>set=new HashSet<>();
for(char c:s.toCharArray()){
set.add(c);
}
while(t-->0){
HashSet<Character>check=new HashSet<>();
int n=in.nextInt();
String ss=in.next();
if(n==5){
for(char ch:ss.toCharArray()){
check.add(ch);
}
boolean value
= set.equals(check);
if(value){
System.out.println("YES");
}
else{
System.out.println("No");
}
}
else{
System.out.println("No");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
5a5cddd6eb85c961381a03b38fb77952
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;
/**
* Description:
*
* @author: hieu
* @since: 30/08/2022
* Project_name: com.example.world_phone.api
*/
public class test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0){
int n = sc.nextInt();
String s = sc.next();
if(n != 5){
System.out.println("NO");
}else {
boolean check = true;
int count = 0;
for (int i = 0; i < s.length(); i++) {
if(s.charAt(i) == 'T'){
check = false;
}
if(s.charAt(i) == 'i' ){
count ++;
}
if(s.charAt(i) == 'm' ){
count+=2;
}
if(s.charAt(i) == 'u' ){
count+=10;
}
if(s.charAt(i) == 'r'){
count+=4;
}
}
if(!check && count == 17){
System.out.println("YES");
}else {
System.out.println("NO");
}
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
46bf82b33b1f00accb763f1fe74d3d24
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.*;
public class weird_algrithm {
static BufferedWriter output = new BufferedWriter(
new OutputStreamWriter(System.out));
static BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
static int mod = 1000000007;
static String toReturn = "";
static int steps = Integer.MAX_VALUE;
static int maxlen = 1000005;
/*MATHEMATICS FUNCTIONS START HERE
MATHS
MATHS
MATHS
MATHS*/
static long gcd(long a, long b) {
if(b == 0) return a;
else return gcd(b, a % b);
}
static long powerMod(long x, long y, int mod) {
if(y == 0) return 1;
long temp = powerMod(x, y / 2, mod);
temp = ((temp % mod) * (temp % mod)) % mod;
if(y % 2 == 0) return temp;
else return ((x % mod) * (temp % mod)) % mod;
}
static long modInverse(long n, int p) {
return powerMod(n, p - 2, p);
}
static long nCr(int n, int r, int mod, long [] fact, long [] ifact) {
return ((fact[n] % mod) * ((ifact[r] * ifact[n - r]) % mod)) % mod;
}
static boolean isPrime(long a) {
if(a == 1) return false;
else if(a == 2 || a == 3 || a== 5) return true;
else if(a % 2 == 0 || a % 3 == 0) return false;
for(int i = 5; i * i <= a; i = i + 6) {
if(a % i == 0 || a % (i + 2) == 0) return false;
}
return true;
}
static int [] seive(int a) {
int [] toReturn = new int [a + 1];
for(int i = 0; i < a; i++) toReturn[i] = 1;
toReturn[0] = 0;
toReturn[1] = 0;
toReturn[2] = 1;
for(int i = 2; i * i <= a; i++) {
if(toReturn[i] == 0) continue;
for(int j = 2 * i; j <= a; j += i) toReturn[j] = 0;
}
return toReturn;
}
static long [] fact(int a) {
long [] arr = new long[a + 1];
arr[0] = 1;
for(int i = 1; i < a + 1; i++) {
arr[i] = (arr[i - 1] * i) % mod;
}
return arr;
}
static ArrayList<Long> divisors(long n) {
ArrayList<Long> arr = new ArrayList<Long>();
for(long i = 2; i * i <= n; i++) {
if(n % i == 0) {
arr.add(i);
if(i != n / i) arr.add(n / i);
}
}
if(n > 1) arr.add(n);
return arr;
}
static int euler(int n) {
int ans = n;
for(int i = 2; i * i <= n; i++) {
if(n % i == 0) {
while(n % i == 0) {
n /= i;
}
ans -= ans / i;
}
}
if(n > 1) ans -= ans / n;
return ans;
}
static long extendedEuclid(long a, long b, long [] arr) {
if(b == 0) {
arr[0] = 1;
arr[1] = 0;
return a;
}
long [] arr1 = new long[2];
long d = extendedEuclid(b, a % b, arr1);
arr[0] = arr1[1];
arr[1] = arr1[0] - arr1[1] * (a / b);
return d;
}
/*MATHS
MATHS
MATHS
MATHS
MATHEMATICS FUNCTIONS END HERE */
/*SWAP FUNCTION START HERE
SWAP
SWAP
SWAP
SWAP
*/
static void swap(int i, int j, long[] arr) {
long temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
static void swap(int i, int j, int[] arr) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
static void swap(int i, int j, String [] arr) {
String temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
static void swap(int i, int j, char [] arr) {
char temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
/*SWAP
SWAP
SWAP
SWAP
SWAP FUNCTION END HERE*/
/*BINARY SEARCH METHODS START HERE
* BINARY SEARCH
* BINARY SEARCH
* BINARY SEARCH
* BINARY SEARCH
*/
static boolean BinaryCheck(long test, long [] arr, long health) {
for(int i = 0; i <= arr.length - 1; i++) {
if(i == arr.length - 1) health -= test;
else if(arr[i + 1] - arr[i] > test) {
health = health - test;
}else {
health = health - (arr[i + 1] - arr[i]);
}
if(health <= 0) return true;
}
return false;
}
static long binarySearchModified(long start1, long n, ArrayList<Integer> arr, int val) {
long start = start1, end = n, ans = -1;
while(start <= end) {
long mid = (start + end) / 2;
if(arr.get((int)mid) >= val) {
if(arr.get((int)mid) == val && mid + 1 < arr.size() && arr.get((int)mid + 1) == val) {
start = mid + 1;
}else if(arr.get((int)mid) == val) {
return mid;
}else end = mid - 1;
}else {
start = mid + 1;
}
}
//System.out.println();
return start;
}
static int upper(int start, int end, ArrayList<Integer> pairs, long val) {
while(start < end) {
int mid = (start + end) / 2;
if(pairs.get(mid) <= val) start = mid + 1;
else end = mid;
}
return start;
}
static int lower(int start, int end, ArrayList<Long> arr, long val) {
while(start < end) {
int mid = (start + end) / 2;
if(arr.get(mid) >= val) end = mid;
else start = mid + 1;
}
return start;
}
/*BINARY SEARCH
* BINARY SEARCH
* BINARY SEARCH
* BINARY SEARCH
* BINARY SEARCH
BINARY SEARCH METHODS END HERE*/
/*RECURSIVE FUNCTION START HERE
* RECURSIVE
* RECURSIVE
* RECURSIVE
* RECURSIVE
*/
static int recurse(int x, int y, int n, int steps1, Integer [][] dp) {
if(x > n || y > n) return 0;
if(dp[x][y] != null) {
return dp[x][y];
}
else if(x == n || y == n) {
return steps1;
}
return dp[x][y] = Math.max(recurse(x + y, y, n, steps1 + 1, dp), recurse(x, x + y, n, steps1 + 1, dp));
}
/*RECURSIVE
* RECURSIVE
* RECURSIVE
* RECURSIVE
* RECURSIVE
RECURSIVE FUNCTION END HERE*/
/*GRAPH FUNCTIONS START HERE
* GRAPH
* GRAPH
* GRAPH
* GRAPH
* */
static class edge{
int from, to;
long weight;
public edge(int x, int y, long weight2) {
this.from = x;
this.to = y;
this.weight = weight2;
}
}
static class sort implements Comparator<TreeNode>{
@Override
public int compare(TreeNode a, TreeNode b) {
// TODO Auto-generated method stub
return 0;
}
}
static void addEdge(ArrayList<ArrayList<edge>> graph, int from, int to, long weight) {
edge temp = new edge(from, to, weight);
edge temp1 = new edge(to, from, weight);
graph.get(from).add(temp);
//graph.get(to).add(temp1);
}
static int ans = 0;
static void topoSort(ArrayList<ArrayList<Integer>> graph, int vertex, boolean [] visited, ArrayList<Integer> toReturn) {
if(visited[vertex]) return;
visited[vertex] = true;
for(int i = 0; i < graph.get(vertex).size(); i++) {
if(!visited[graph.get(vertex).get(i)]) topoSort(graph, graph.get(vertex).get(i), visited, toReturn);
}
toReturn.add(vertex);
}
static boolean isCyclicDirected(ArrayList<ArrayList<Integer>> graph, int vertex, boolean [] visited, boolean [] reStack) {
if(reStack[vertex]) return true;
if(visited[vertex]) return false;
reStack[vertex] = true;
visited[vertex] = true;
for(int i = 0; i < graph.get(vertex).size(); i++) {
if(isCyclicDirected(graph, graph.get(vertex).get(i), visited, reStack)) return true;
}
reStack[vertex] = false;
return false;
}
static int e = 0;
static long mst(PriorityQueue<edge> pq, int nodes) {
long weight = 0;
int [] size = new int[nodes + 1];
Arrays.fill(size, 1);
while(!pq.isEmpty()) {
edge temp = pq.poll();
int x = parent(parent, temp.to);
int y = parent(parent, temp.from);
if(x != y) {
//System.out.println(temp.weight);
union(x, y, rank, parent, size);
weight += temp.weight;
e++;
}
}
return weight;
}
static void floyd(long [][] dist) { // to find min distance between two nodes
for(int k = 0; k < dist.length; k++) {
for(int i = 0; i < dist.length; i++) {
for(int j = 0; j < dist.length; j++) {
if(dist[i][j] > dist[i][k] + dist[k][j]) {
dist[i][j] = dist[i][k] + dist[k][j];
}
}
}
}
}
static void dijkstra(ArrayList<ArrayList<edge>> graph, long [] dist, int src) {
for(int i = 0; i < dist.length; i++) dist[i] = Long.MAX_VALUE / 2;
dist[src] = 0;
boolean visited[] = new boolean[dist.length];
PriorityQueue<pair> pq = new PriorityQueue<>();
pq.add(new pair(src, 0));
while(!pq.isEmpty()) {
pair temp = pq.poll();
int index = (int)temp.a;
for(int i = 0; i < graph.get(index).size(); i++) {
if(dist[graph.get(index).get(i).to] > dist[index] + graph.get(index).get(i).weight) {
dist[graph.get(index).get(i).to] = dist[index] + graph.get(index).get(i).weight;
pq.add(new pair(graph.get(index).get(i).to, graph.get(index).get(i).weight));
}
}
}
}
static int parent1 = -1;
static boolean ford(ArrayList<ArrayList<edge>> graph1, ArrayList<edge> graph, long [] dist, int src, int [] parent) {
for(int i = 0; i < dist.length; i++) dist[i] = Long.MIN_VALUE / 2;
dist[src] = 0;
boolean hasNeg = false;
for(int i = 0; i < dist.length - 1; i++) {
for(int j = 0; j < graph.size(); j++) {
int from = graph.get(j).from;
int to = graph.get(j).to;
long weight = graph.get(j).weight;
if(dist[to] < dist[from] + weight) {
dist[to] = dist[from] + weight;
parent[to] = from;
}
}
}
for(int i = 0; i < graph.size(); i++) {
int from = graph.get(i).from;
int to = graph.get(i).to;
long weight = graph.get(i).weight;
if(dist[to] < dist[from] + weight) {
parent1 = from;
hasNeg = true;
/*
* dfs(graph1, parent1, new boolean[dist.length], dist.length - 1);
* //System.out.println(ans); dfs(graph1, 0, new boolean[dist.length], parent1);
*/
//System.out.println(ans);
if(ans == 2) break;
else ans = 0;
}
}
return hasNeg;
}
/*GRAPH FUNCTIONS END HERE
* GRAPH
* GRAPH
* GRAPH
* GRAPH
*/
/*disjoint Set START HERE
* disjoint Set
* disjoint Set
* disjoint Set
* disjoint Set
*/
static int [] rank;
static int [] parent;
static int parent(int [] parent, int x) {
if(parent[x] == x) return x;
else return parent[x] = parent(parent, parent[x]);
}
static boolean union(int x, int y, int [] rank, int [] parent, int [] setSize) {
if(parent(parent, x) == parent(parent, y)) {
return true;
}
if (rank[x] > rank[y]) {
parent[y] = x;
setSize[x] += setSize[y];
} else {
parent[x] = y;
setSize[y] += setSize[x];
if (rank[x] == rank[y]) rank[y]++;
}
return false;
}
/*disjoint Set END HERE
* disjoint Set
* disjoint Set
* disjoint Set
* disjoint Set
*/
/*INPUT START HERE
* INPUT
* INPUT
* INPUT
* INPUT
* INPUT
*/
static int nextInt() throws NumberFormatException, IOException {
return Integer.parseInt(sc.readLine());
}
static long nextLong() throws NumberFormatException, IOException {
return Long.parseLong(sc.readLine());
}
static long [] inputLongArr() throws NumberFormatException, IOException{
String [] s = sc.readLine().split(" ");
long [] toReturn = new long[s.length];
for(int i = 0; i < s.length; i++) {
toReturn[i] = Long.parseLong(s[i]);
}
return toReturn;
}
static int max = 0;
static int [] inputIntArr() throws NumberFormatException, IOException{
String [] s = sc.readLine().split(" ");
//System.out.println(s.length);
int [] toReturn = new int[s.length];
for(int i = 0; i < s.length; i++) {
toReturn[i] = Integer.parseInt(s[i]);
}
return toReturn;
}
/*INPUT
* INPUT
* INPUT
* INPUT
* INPUT
* INPUT END HERE
*/
static long [] preCompute(int level) {
long [] toReturn = new long[level];
toReturn[0] = 1;
toReturn[1] = 16;
for(int i = 2; i < level; i++) {
toReturn[i] = ((toReturn[i - 1] % mod) * (toReturn[i - 1] % mod)) % mod;
}
return toReturn;
}
static class pair{
long a;
long b;
long d;
public pair(long in, long y) {
this.a = in;
this.b = y;
this.d = 0;
}
}
static int [] nextGreaterBack(char [] s) {
Stack<Integer> stack = new Stack<>();
int [] toReturn = new int[s.length];
for(int i = 0; i < s.length; i++) {
if(!stack.isEmpty() && s[stack.peek()] >= s[i]) {
stack.pop();
}
if(stack.isEmpty()) {
stack.push(i);
toReturn[i] = -1;
}else {
toReturn[i] = stack.peek();
stack.push(i);
}
}
return toReturn;
}
static int [] nextGreaterFront(char [] s) {
Stack<Integer> stack = new Stack<>();
int [] toReturn = new int[s.length];
for(int i = s.length - 1; i >= 0; i--) {
if(!stack.isEmpty() && s[stack.peek()] >= s[i]) {
stack.pop();
}
if(stack.isEmpty()) {
stack.push(i);
toReturn[i] = -1;
}else {
toReturn[i] = stack.peek();
stack.push(i);
}
}
return toReturn;
}
static int [] lps(String s) {
int [] lps = new int[s.length()];
lps[0] = 0;
int j = 0;
for(int i = 1; i < lps.length; i++) {
j = lps[i - 1];
while(j > 0 && s.charAt(i) != s.charAt(j)) j = lps[j - 1];
if(s.charAt(i) == s.charAt(j)) {
lps[i] = j + 1;
}
}
return lps;
}
static int [][] vectors = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
static String dir = "DRUL";
static boolean check(int i, int j, boolean [][] visited) {
if(i >= visited.length || j >= visited[0].length) return false;
if(i < 0 || j < 0) return false;
return true;
}
static void selectionSort(long arr[], long [] arr1, ArrayList<ArrayList<Integer>> ans)
{
int n = arr.length;
for (int i = 0; i < n-1; i++)
{
int min_idx = i;
for (int j = i+1; j < n; j++)
if (arr[j] < arr[min_idx])
min_idx = j;
else if(arr[j] == arr[min_idx]) {
if(arr1[j] < arr1[min_idx]) min_idx = j;
}
if(i == min_idx) {
continue;
}
ArrayList<Integer> p = new ArrayList<Integer>();
p.add(min_idx + 1);
p.add(i + 1);
ans.add(new ArrayList<Integer>(p));
swap(i, min_idx, arr);
swap(i, min_idx, arr1);
}
}
static int saved = Integer.MAX_VALUE;
static String ans1 = "";
public static boolean isValid(int x, int y, String [] mat) {
if(x >= mat.length || x < 0) return false;
if(y >= mat[0].length() || y < 0) return false;
return true;
}
public static void recurse3(ArrayList<Character> arr, int index, String s, int max, ArrayList<String> toReturn) {
if(s.length() == max) {
toReturn.add(s);
return;
}
if(index == arr.size()) return;
recurse3(arr, index + 1, s + arr.get(index), max, toReturn);
recurse3(arr, index + 1, s, max, toReturn);
}
/*
if(arr[i] > q) return Math.max(f(i + 1, q - 1) + 1, f(i + 1, q);
else return f(i + 1, q) + 1
*/
static void dfsDP(ArrayList<ArrayList<Integer>> graph, int src, int [] dp1, int [] dp2, int parent) {
int sum1 = 0; int sum2 = 0;
for(int x : graph.get(src)) {
if(x == parent) continue;
dfsDP(graph, x, dp1, dp2, src);
sum1 += Math.min(dp1[x], dp2[x]);
sum2 += dp1[x];
}
dp1[src] = 1 + sum1;
dp2[src] = sum2;
System.out.println(src + " " + dp1[src] + " " + dp2[src]);
}
static int balanced = 0;
static void dfs(ArrayList<ArrayList<ArrayList<Long>>> graph, long src, int [] dist, long sum1, long sum2, long parent, ArrayList<Long> arr, int index) {
index = 0;//binarySearch(index, arr.size() - 1, arr, sum1);
if(index < arr.size() && arr.get(index) <= sum1) {
dist[(int)src] = index + 1;
}
else dist[(int)src] = index;
for(ArrayList<Long> x : graph.get((int)src)) {
if(x.get(0) == parent) continue;
if(arr.size() != 0) arr.add(arr.get(arr.size() - 1) + x.get(2));
else arr.add(x.get(2));
dfs(graph, x.get(0), dist, sum1 + x.get(1), sum2, src, arr, index);
arr.remove(arr.size() - 1);
}
}
static int compare(String s1, String s2) {
Queue<Character> q1 = new LinkedList<>();
Queue<Character> q2 = new LinkedList<Character>();
for(int i = 0; i < s1.length(); i++) {
q1.add(s1.charAt(i));
q2.add(s2.charAt(i));
}
int k = 0;
while(k < s1.length()) {
if(q1.equals(q2)) {
break;
}
q2.add(q2.poll());
k++;
}
return k;
}
static long pro = 0;
public static int len(ArrayList<ArrayList<Integer>> graph, int src, boolean [] visited
) {
visited[src] = true;
int max = 0;
for(int x : graph.get(src)) {
if(!visited[x]) {
visited[x] = true;
int len = len(graph, x, visited) + 1;
//System.out.println(len);
pro = Math.max(max * (len - 1), pro);
max = Math.max(len, max);
}
}
return max;
}
public static void recurse(int l, int [] ans) {
if(l < 0) return;
int r = (int)Math.sqrt(l * 2);
int s = r * r;
r = s - l;
recurse(r - 1, ans);
while(r <= l) {
ans[r] = l;
ans[l] = r;
r++;
l--;
}
}
static boolean isSmaller(String str1, String str2)
{
// Calculate lengths of both string
int n1 = str1.length(), n2 = str2.length();
if (n1 < n2)
return true;
if (n2 < n1)
return false;
for (int i = 0; i < n1; i++)
if (str1.charAt(i) < str2.charAt(i))
return true;
else if (str1.charAt(i) > str2.charAt(i))
return false;
return false;
}
// Function for find difference of larger numbers
static String findDiff(String str1, String str2)
{
// Before proceeding further, make sure str1
// is not smaller
if (isSmaller(str1, str2)) {
String t = str1;
str1 = str2;
str2 = t;
}
// Take an empty string for storing result
String str = "";
// Calculate length of both string
int n1 = str1.length(), n2 = str2.length();
// Reverse both of strings
str1 = new StringBuilder(str1).reverse().toString();
str2 = new StringBuilder(str2).reverse().toString();
int carry = 0;
// Run loop till small string length
// and subtract digit of str1 to str2
for (int i = 0; i < n2; i++) {
// Do school mathematics, compute difference of
// current digits
int sub
= ((int)(str1.charAt(i) - '0')
- (int)(str2.charAt(i) - '0') - carry);
// If subtraction is less than zero
// we add then we add 10 into sub and
// take carry as 1 for calculating next step
if (sub < 0) {
sub = sub + 10;
carry = 1;
}
else
carry = 0;
str += (char)(sub + '0');
}
// subtract remaining digits of larger number
for (int i = n2; i < n1; i++) {
int sub = ((int)(str1.charAt(i) - '0') - carry);
// if the sub value is -ve, then make it
// positive
if (sub < 0) {
sub = sub + 10;
carry = 1;
}
else
carry = 0;
str += (char)(sub + '0');
}
// reverse resultant string
return new StringBuilder(str).reverse().toString();
}
static void solve() throws IOException {
/*
while(true) {
long [] n = inputLongArr();
if(n[0] == 0 && n[1] == 0 && n[2] == 0 && n[3] == 0) break;
long d = (n[3] + n[2] - n[0]);
System.out.println(d);
long [] ans = new long [2];
long gcd;
if(d < 0) {
n[1] = -1 * n[1];
}else n[2] = -1 * n[2];
gcd = extendedEuclid(Math.abs(n[1]), Math.abs(n[2]), ans);
if(d % gcd == 0) {
System.out.println(ans[0] + " " + ans[1]);
ans[0] *= Math.abs(d) / gcd;
ans[1] *= Math.abs(d) / gcd;
//System.out.println(ans[0] + " " + ans[1]);
if(n[1] < 0) {
ans[0] *= -1;
}
if(n[2] < 0) {
ans[1] *= -1;
}
if(ans[1] < 0) {
long k = -1 * (long)Math.ceil(ans[1] / (double)n[1]);
System.out.println(k);
ans[0] = ans[0] - n[2] * k;
ans[1] = ans[1] + n[1] * k;
}
if(ans[0] < 0) {
long k = (long)Math.ceil(ans[0] / (double)n[2]);
ans[0] = ans[0] - n[2] * k;
ans[1] = ans[1] + n[1] * k;
System.out.println(ans[0] + " " + ans[1] + " 1");
}
output.write(n[0] + ans[0] * n[1] + "\n");
System.out.println(ans[0] + " " + ans[1]);
}else {
output.write("Impossible\n");
}
}
*/
int n = nextInt();
char [] s = sc.readLine().toCharArray();
int [] hash = new int [256];
char [] given = "Timur".toCharArray();
Arrays.sort(s);
Arrays.sort(given);
if(s.length != given.length) {
output.write("NO\n");
return;
}
for(int i = 0; i < s.length; i++) {
if(s[i] != given[i]) {
output.write("NO\n");
return;
}
}
output.write("YES\n");
/*
int n = nextInt();
String s = sc.readLine();
long [] dp = new long [n];
long sum = 0;
for(int i = 0; i < n; i++) {
if(s.charAt(i) == 'L') {
sum += i;
}else sum += s.length() - 1 - i;
}
for(int i = 0; i < n; i++) {
if(i < n / 2) {
if(s.charAt(i) == 'L') {
sum -= i;
sum += s.length() - 1 - i;
}
}
}
*/
}
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
int t = Integer.parseInt(sc.readLine()); for(int i = 0; i < t; i++)
solve();
output.flush();
}
}
class TreeNode {
int val; int index;
public TreeNode(int val, int index) {
this.val = val;
this.index = index;
}
public String toString() {
return val + " " + index;
}
}
/*
1
10
6 10 7 9 11 99 45 20 88 31
*/
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
f4846ab0095dee618bac09b8f1d7e87a
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
HashMap<Character,Integer> hm=new HashMap<>();
hm.put('T',1);
hm.put('i',1);
hm.put('m',1);
hm.put('u',1);
hm.put('r',1);
int s=hm.size();
int n=sc.nextInt();
String str=sc.next();
boolean flag=false;
int i=0;
for(i=0;i<str.length();i++){
char ch=str.charAt(i);
if(hm.containsKey(ch)==false)
{System.out.println("NO");
flag=true;
break;
}
hm.remove(ch);
}
if(!flag && i==s)
System.out.println("YES");
else if(!flag)
System.out.println("NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
910eac6763708c5494108742d2981364
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class solve {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int n=sc.nextInt();
sc.nextLine();
String s=sc.nextLine();
int flag=-1;
int c=0;
HashMap<Character,Integer>m=new HashMap<>();
for(int i=0;i<n;i++)
{
//if(s.charAt(i)!='T'||s.charAt(i)!='i'||s.charAt(i)!='m'||s.charAt(i)!='u'||s.charAt(i)!='r')
//{
// flag=0;break;
//}
if(s.charAt(i)=='T'||s.charAt(i)=='i'||s.charAt(i)=='m'||s.charAt(i)=='u'||s.charAt(i)=='r')
{
if(m.containsKey(s.charAt(i)))
m.put(s.charAt(i),m.get(s.charAt(i))+1);
else
m.put(s.charAt(i), 1);
}
}
if(m.size()==5&&n==5)
System.out.println("YES");
else
System.out.println("NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
8797f14f988bf96ab8877515d8e6d308
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Loop {
public static void main(String args[])
{
Scanner ob = new Scanner(System.in);
short t=ob.nextShort();
String s,a;
char ch;
byte l,c;
for(short i=0;i<t;i++)
{
a="Timur";
c=0;
l=ob.nextByte();
s=ob.next();
if(l!=5)
System.out.println("No");
else
{
for(int j=0;j<l;j++)
{
ch=s.charAt(j);
if(a.indexOf(ch)>-1)
{
c++;
a=a.replace(ch,'*');
}
}
if(c==5)
System.out.println("Yes");
else
System.out.println("No");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 11
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
6cacad42871b796f7a217b5f06054707
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;
/**
*
* @author mafia
*/
public class ProblemSolving {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner scan =new Scanner(System.in);
int t,n;
String name;
t=scan.nextInt();
while(t-->0){
n=scan.nextInt();
name=scan.next();
if(n==5&&name.contains("T")&&name.contains("u")&&name.contains("r")&&name.contains("i")&&name.contains("m"))
System.out.println("YES");
else
System.out.println("NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
bd4b04041f3665d7158976f114622dbe
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;
/**
*
* @author mafia
*/
public class ProblemSolving {
public static void main(String[] args) {
int t, num;
String name;
Scanner scan = new Scanner(System.in);
t = scan.nextInt();
while (t-- > 0) {
num = scan.nextInt();
name = scan.next();
if (num == 5 && name.contains("T") && name.contains("i") && name.contains("u")
&& name.contains("r") && name.contains("m")) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
1e43e70a9574f62b8dc625b2bae946ff
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
//package codeForces;
import java.util.HashMap;
import java.util.Scanner;
public class A_1722 {
static final Scanner sc = new Scanner(System.in);
static boolean solve() {
int n = Integer.parseInt(sc.nextLine());
String str = sc.nextLine();
if (n != 5) {
return false;
}
HashMap<Character, Integer> hashMap = new HashMap<>();
for (char i : str.toCharArray()) {
if (hashMap.containsKey(i)) {
hashMap.put(i, hashMap.get(i) + 1);
} else {
hashMap.put(i, 1);
}
}
for (char i : "Timur".toCharArray()) {
if (!hashMap.containsKey(i) || hashMap.get(i) == 0) {
return false;
} else {
hashMap.put(i, hashMap.get(i) - 1);
}
}
return true;
}
public static void main(String[] args) {
int t = Integer.parseInt(sc.nextLine());
while (t-- > 0) {
boolean b = solve();
System.out.println(b ? "YES" : "NO");
}
}
// TEMPLATES
public static final String ALPHABET = "abcdefghijklmnopqrstuvwxyz";
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
30d86a86f8a9c5ed2046b200315c2739
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.*;
import java.util.StringTokenizer;
import static java.lang.Character.isUpperCase;
//import static jdk.nashorn.internal.objects.NativeString.toUpperCase;
public class Div1 {
public static void main(String[] args) {
FastReader input = new FastReader();
int N = input.nextInt();
for (int i=0;i<N;i++) {
int M = input.nextInt();
String S = input.nextLine();
if (S.length()==5 && S.contains("T") && S.contains("m") && S.contains("i") && S.contains("r") && S.contains("u"))
System.out.println("YES");
else
System.out.println("NO");
//if (S.equals("TIMUR") || S.equals("MIURT") || S.equals("TRUMI") || S.equals("MRITU"))
// ch=true;
// System.out.println(ch);
//System.out.println(count2);
//if ( ch==true && count2!=-1){
// System.out.println("YES");
// }
// else{
//System.out.println("NO");}
// }
}
}
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
public FastReader(String file) throws FileNotFoundException {
br = new BufferedReader(new FileReader(file));
}
void close() throws IOException {
br.close();
}
String next() {
while (st == null || !st.hasMoreElements()) { // null = The First time
//!st.hasNoElements = After the st finish the first time
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
long nextLong() {
return Long.parseLong(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
boolean hasNext() {
String s = null;
try {
s = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
if (s == null) return false;
st = new StringTokenizer(s);
return true;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
fd747618f9dfd3c02d20657588699d64
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
/*
...|/G\/E\/O\/R\/G\/E\|...
*/
//Advanced Java
//BufferedWriter
//BufferedReader
import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.util.stream.LongStream;
public class OOP4{
static class FastReader{
BufferedReader br;
StringTokenizer st;
public FastReader(){
br=new BufferedReader(new InputStreamReader(System.in));
}
String next(){
while(st==null || !st.hasMoreTokens()){
try {
st=new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt(){
return Integer.parseInt(next());
}
long nextLong(){
return Long.parseLong(next());
}
double nextDouble(){
return Double.parseDouble(next());
}
String nextLine(){
String str="";
try {
str=br.readLine().trim();
} catch (Exception e) {
e.printStackTrace();
}
return str;
}
}
static class FastWriter {
private final BufferedWriter bw;
public FastWriter() {
this.bw = new BufferedWriter(new OutputStreamWriter(System.out));
}
public void print(Object object) throws IOException {
bw.append("").append(String.valueOf(object));
}
public void println(Object object) throws IOException {
print(object);
bw.append("\n");
}
public void close() throws IOException {
bw.close();
}
}
public static void main(String[] args) {
try {
FastReader in = new FastReader();
FastWriter out = new FastWriter();
int x =in.nextInt();
for (int i = 1; i <= x; i++) {
int y =in.nextInt();
String z =in.next ();
if(y==5){
if(z.contains("i")&&z.contains("u")&&z.contains("m")&&z.contains("r")&&z.contains("T"))System.out.println("YES");
else System.out.println("NO");
}
else
System.out.println("NO");
}
}catch (Exception e) {
return;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
cd3919bdf3f7db0c03678e09c99f9d73
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
/*
...|/G\/E\/O\/R\/G\/E\|...
*/
//Advanced Java
//BufferedWriter
//BufferedReader
import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.util.stream.LongStream;
public class OOP4{
static class FastReader{
BufferedReader br;
StringTokenizer st;
public FastReader(){
br=new BufferedReader(new InputStreamReader(System.in));
}
String next(){
while(st==null || !st.hasMoreTokens()){
try {
st=new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt(){
return Integer.parseInt(next());
}
long nextLong(){
return Long.parseLong(next());
}
double nextDouble(){
return Double.parseDouble(next());
}
String nextLine(){
String str="";
try {
str=br.readLine().trim();
} catch (Exception e) {
e.printStackTrace();
}
return str;
}
}
static class FastWriter {
private final BufferedWriter bw;
public FastWriter() {
this.bw = new BufferedWriter(new OutputStreamWriter(System.out));
}
public void print(Object object) throws IOException {
bw.append("").append(String.valueOf(object));
}
public void println(Object object) throws IOException {
print(object);
bw.append("\n");
}
public void close() throws IOException {
bw.close();
}
}
public static void main(String[] args) {
try {
FastReader in = new FastReader();
FastWriter out = new FastWriter();
int x =in.nextInt();
for (int i = 1; i <= x; i++) {
int y =in.nextInt();
String z =in.next ();
if(y==5)
{
if( z.contains("i") && z.contains("u") && z.contains("m") && z.contains("r") && z.contains("T"))
System.out.println("YES");
else
System.out.println("NO");
}
else
System.out.println("NO");
}
out.close();
}
catch (Exception e) {
return;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
f740317ece5e3ea8da9fb4d6fff82ef5
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
/*
...|/G\/E\/O\/R\/G\/E\|...
*/
//Advanced Java
//BufferedWriter
//BufferedReader
import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.util.stream.LongStream;
public class OOP4{
static class FastReader{
BufferedReader br;
StringTokenizer st;
public FastReader(){
br=new BufferedReader(new InputStreamReader(System.in));
}
String next(){
while(st==null || !st.hasMoreTokens()){
try {
st=new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt(){
return Integer.parseInt(next());
}
long nextLong(){
return Long.parseLong(next());
}
double nextDouble(){
return Double.parseDouble(next());
}
String nextLine(){
String str="";
try {
str=br.readLine().trim();
} catch (Exception e) {
e.printStackTrace();
}
return str;
}
}
static class FastWriter {
private final BufferedWriter bw;
public FastWriter() {
this.bw = new BufferedWriter(new OutputStreamWriter(System.out));
}
public void print(Object object) throws IOException {
bw.append("").append(String.valueOf(object));
}
public void println(Object object) throws IOException {
print(object);
bw.append("\n");
}
public void close() throws IOException {
bw.close();
}
}
public static void main(String[] args) {
try {
FastReader in = new FastReader();
FastWriter out = new FastWriter();
int x =in.nextInt();
for (int i = 1; i <= x; i++) {
int y =in.nextInt();
String z =in.next ();
if(y==5 && z.contains("i") && z.contains("u") && z.contains("m") && z.contains("r") && z.contains("T"))
System.out.println("YES");
else System.out.println("NO");
}
out.close();
} catch (Exception e) {
return;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
6599b96e82b8a68cf73a6d45596196df
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
/*
...|/G\/E\/O\/R\/G\/E\|...
*/
import java.io.*;
import java.util.StringTokenizer;
import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
public class Main {
static BufferedWriter of = null;
static {
try {
of = new BufferedWriter(new FileWriter(new File("filee.txt")));
} catch (IOException e) {
e.printStackTrace();
}
}
private static BufferedWriter ifile = null;
static {
try {
ifile = new BufferedWriter(new FileWriter(String.valueOf(System.in)));
} catch (IOException e) {
e.printStackTrace();
}
}
private static final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
private static final Fast in = new Fast();
public static void main(String[] args) throws IOException {
int n = in.nextInt();
while(n>0)
{
int m = in.nextInt();
String s = in.next();
if (m==5 && s.contains("m") && s.contains("i") && s.contains("T") && s.contains("r") && s.contains("u"))
System.out.println("YES");
else
System.out.println("NO");
n--;
}
}
public static class Fast {
BufferedReader br;
StringTokenizer st;
public Fast() {
br = new BufferedReader(new InputStreamReader(System.in));
}
public Fast(FileReader f) {
br = new BufferedReader(f);
}
public String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public int nextInt() throws IOException {
return parseInt(next());
}
public long nextLong() throws IOException {
return parseLong(next());
}
public double nextDouble() throws IOException {
return parseDouble(next());
}
public float nextFloat() throws IOException {
return Float.parseFloat(next());
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
fc5bcdb6b2de1ac9a8c0cb509a3a4a64
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;
import java.util.ArrayList;
public class spell_check {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int testCases = scn.nextInt();
while(testCases-- != 0){
int length = scn.nextInt();
String name = scn.next();
System.out.println(name.contains("T")&&name.contains("i")&&name.contains("m")&&name.contains("u")&&name.contains("r")&&length==5?"YES":"NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
a40b26c65678046ea421100031145b89
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String arg[]) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t-- > 0) {
int n = in.nextInt();
String s = in.next();
int arr[] = {84, 105, 109, 114, 117};
int ch[]= new int[5];
if(s.length()>5 || s.length()<5){
System.out.println("no");
}else{
for (int i = 0; i < 5; i++) {
ch[i]=(int)s.charAt(i);
}
Arrays.sort(ch);
int i = 0;
for (i = 0; i < 5; i++) {
if(arr[i]!=ch[i]){
break;
}
}
if(i == 5){
System.out.println("yes");
}else{
System.out.println("no");
}
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
ddb1ae8e4241de99cdfae20a6a664690
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
static int cnt= 0;
static char []arr = {'T', 'i', 'm', 'u', 'r'};
static boolean visited[] = new boolean[5];
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int t = Integer.parseInt(br.readLine());
for(int i=0; i<t;i++) {
int n = Integer.parseInt(br.readLine());
String name = br.readLine();
fun(n,name);
if(n==5 && cnt==5) System.out.println("YES");
else System.out.println("NO");
cnt=0;
}
}
public static void fun(int num, String name) {
char []nameArr = name.toCharArray();
for(int i=0; i< num; i++) {
for(int j=0; j<5;j++) {
if(visited[j]==true) continue;
if(nameArr[i]==arr[j]) {
visited[j]=true;
cnt++;
}
}
}
for(int i=0; i<5;i++) {
visited[i] = false;
}
return;
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
7980cdbd8a5146734895a71776941b7b
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;
public class Spell {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t-- != 0) {
int n = in.nextInt();
String s = in.next();
if((s.contains("T") && s.contains("i") && s.contains("m") && s.contains("u")
&& s.contains("r") && s.length() == 5)) {
System.out.println("YES");
}
else
System.out.println("NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
b7aa8c84fd51ee9f61da8d1983570c76
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Hisoka {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int x =in.nextInt();
for (int i = 1; i <= x; i++) {
int c=0;
int y =in.nextInt();
String z =in.next ();
if(y==5&&z.contains("i")&&z.contains("u")&&z.contains("m")&&z.contains("r")&&z.contains("T"))System.out.println("YES");
else System.out.println("NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
2e5c5e18289f12d23749c6aa2f0f9784
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int len = sc.nextInt();
String a = sc.next();
if(a.length() == 5 && a.contains("T") && a.contains("i")&&a.contains("m") && a.contains("u") && a.contains("r")){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
a283c6bc2adf50ddb79cc67714fb9a54
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class CodeForces{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt();
String str = sc.next();
if(n>5 || n<5){
System.out.println("NO");
continue;
}
String s = "Timur";
HashMap<Character,Integer> map = new HashMap<>();
for(int i=0;i<n;i++){
if(map.containsKey(str.charAt(i))){
map.put(str.charAt(i),map.get(str.charAt(i))+1);
}
else{
map.put(str.charAt(i),1);
}
}
boolean flag = true;
for(int i=0;i<n;i++){
if(!map.containsKey(s.charAt(i))){
System.out.println("NO");
flag = false;
break;
}
}
if(flag){
System.out.println("YES");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
bccf9aaca39ad7d1fa4abf431c7c7d07
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class D
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
// System.out.println("enter teste case");
int test=sc.nextInt();
char s[]=("Timur").toCharArray();
Arrays.sort(s);
sc.nextLine();
for(int i=1;i<=test;i++)
{
int l=sc.nextInt();
sc.nextLine();
String r=sc.nextLine();
char a[]=r.toCharArray();
Arrays.sort(a);
if(Arrays.equals(s,a))
System.out.println("YES");
else
System.out.println("NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
492fd55211e290fd05516cccf53d8784
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Arrays;
import java.util.Scanner;
public class cf {
public static String sortString(String inputString)
{
char array[] = inputString.toCharArray();
Arrays.sort(array);
return new String(array);
}
public static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int t = sc.nextInt();
String s = "Timur";
String checker = sortString(s);
for(int i=0;i<t;i++) {
int n = sc.nextInt();
String s1= sc.next();
String check = sortString(s1);
if(checker.equals(check)){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
0858ffba01aa30d1368a36913f31da6f
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;
public class Train {
public static void main(String[] args)
{
Scanner sc =new Scanner(System.in);
int saces =sc.nextInt();
String temp ="Timur";
for (int i = 0; i < saces; i++)
{
int length =sc.nextInt();
String s =sc.next();
String a ="";
for (int j = 0; j < length; j++)
{
a+=String.valueOf(s.charAt(j));
}
if (a.length()==temp.length()&& a.contains("T") && a.contains("i")&& a.contains("m")&& a.contains("u")&& a.contains("r"))
System.out.println("YES");
else
System.out.println("NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
72538a4645fef245fafb8729c35b5b6a
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.*;
import java.lang.*;
import java.util.*;
public class Main {
static PrintWriter out;
static int MOD = 1000000007;
static FastReader scan;
/*-------- I/O usaing short named function ---------*/
public static String ns() {
return scan.next();
}
public static int ni() {
return scan.nextInt();
}
public static long nl() {
return scan.nextLong();
}
public static double nd() {
return scan.nextDouble();
}
public static String nln() {
return scan.nextLine();
}
public static void p(Object o) {
out.print(o);
}
public static void ps(Object o) {
out.print(o + " ");
}
public static void pn(Object o) {
out.println(o);
}
/*-------- for output of an array ---------------------*/
static void iPA(int arr[]) {
StringBuilder output = new StringBuilder();
for (int i = 0; i < arr.length; i++) output.append(arr[i] + " ");
out.println(output);
}
static void lPA(long arr[]) {
StringBuilder output = new StringBuilder();
for (int i = 0; i < arr.length; i++) output.append(arr[i] + " ");
out.println(output);
}
static void sPA(String arr[]) {
StringBuilder output = new StringBuilder();
for (int i = 0; i < arr.length; i++) output.append(arr[i] + " ");
out.println(output);
}
static void dPA(double arr[]) {
StringBuilder output = new StringBuilder();
for (int i = 0; i < arr.length; i++) output.append(arr[i] + " ");
out.println(output);
}
/*-------------- for input in an array ---------------------*/
static void iIA(int arr[]) {
for (int i = 0; i < arr.length; i++) arr[i] = ni();
}
static void lIA(long arr[]) {
for (int i = 0; i < arr.length; i++) arr[i] = nl();
}
static void sIA(String arr[]) {
for (int i = 0; i < arr.length; i++) arr[i] = ns();
}
static void dIA(double arr[]) {
for (int i = 0; i < arr.length; i++) arr[i] = nd();
}
/*------------ for taking input faster ----------------*/
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
// Method to check if x is power of 2
static boolean isPowerOfTwo(int x) {
return x != 0 && ((x & (x - 1)) == 0);
}
//Method to return lcm of two numbers
static int gcd(int a, int b) {
return a == 0 ? b : gcd(b % a, a);
}
//Method to count digit of a number
static int countDigit(long n) {
return (int) Math.floor(Math.log10(n) + 1);
}
//Method for sorting
static void sort(int[] a) {
ArrayList<Integer> l = new ArrayList<>();
for (int i : a) l.add(i);
Collections.sort(l);
for (int i = 0; i < a.length; i++) a[i] = l.get(i);
}
//Method for checking if a number is prime or not
static boolean isPrime(int n) {
if (n <= 1) return false;
if (n <= 3) return true;
if (n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; i * i <= n; i = i + 6) if (
n % i == 0 || n % (i + 2) == 0
) return false;
return true;
}
public static void reverse(int a[], int n)
{
int i, k, t;
for (i = 0; i < n / 2; i++) {
t = a[i];
a[i] = a[n - i - 1];
a[n - i - 1] = t;
}
// printing the reversed array
System.out.println("Reversed array is: \n");
for (k = 0; k < n; k++) {
System.out.println(a[k]);
}
}
public static int binarysearch(int arr[],int left,int right,int num){
int idx=0;
while(left<=right){
int mid=(left+right)/2;
if(arr[mid]>=num){
idx=mid;
if(arr[mid]==num)break;
right=mid-1;
}else{
left=mid+1;
}
}
return idx;
}
public static void main(String[] args) throws java.lang.Exception {
OutputStream outputStream = System.out;
out = new PrintWriter(outputStream);
scan = new FastReader();
//for fast output sometimes
HashSet<Integer> set = new HashSet<>();
StringBuilder sb = new StringBuilder();
int t = ni();
while(t-->0){
int n=ni();
String str=scan.nextLine();
if(n>5||n<5){
System.out.println("NO");
continue;
}
boolean flag=true;
int arr[]=new int[26];
HashSet<Character> et=new HashSet<>();
et.add('T');
et.add('i');
et.add('m');
et.add('u');
et.add('r');
for(int i=0;i<5;i++){
if(et.contains(str.charAt(i))==false){
flag=false;
break;
}else{
et.remove(str.charAt(i));
}
}
if(flag)System.out.println("YES");
else System.out.println("NO");
}
out.flush();
out.close();
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
ab2fd143cc76a6b6ff7f4fd270b78f7c
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.lang.*;
import java.io.*;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
public class A
{
public static void main (String[] args) throws java.lang.Exception
{
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int t = sc.nextInt();
while (t-- != 0)
{
int n = sc.nextInt();
String s = sc.next();
Map<String, Integer> m = new HashMap<>();
m.put("T", 1);
m.put("i", 1);
m.put("m", 1);
m.put("u", 1);
m.put("r", 1);
boolean isValid = true;
for (int i = 0; i < s.length(); i++)
{
String c = s.charAt(i) + "";
if (m.containsKey(c))
{
m.put(c, m.get(c) - 1);
}
else
{
isValid = false;
}
}
for (Map.Entry<String, Integer> e : m.entrySet())
{
isValid = isValid && e.getValue() == 0;
}
out.println(isValid ? "YES" : "NO");
}
out.close();
}
public static PrintWriter out;
public static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine(){
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
4b0260a1362845e7a270809ca56be585
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class A {
public static void main(String[] args) {
try(Scanner s = new Scanner(System.in)){
int count = s.nextInt();
for (int i = 0; i < count; i++) {
int len = s.nextInt();
String s1 = s.next();
Map<Character,Integer> map = new HashMap<>();
for (int j = 0; j < len; j++) {
map.put(s1.charAt(j), 1);
}
if (len == 5 && map.containsKey('T') && map.containsKey('i') && map.containsKey('u') && map.containsKey('r')
&& map.containsKey('m')){
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
d4aa58b34f03ee836a31fa9277b79f31
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.lang.*;
public class Solution{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
String s=sc.next();
if(n!=5){
System.out.println("NO");
}
if(n==5){
String z="Timur";
char b[]= new char[5];
for(int i=0;i<5;i++){
b[i]=z.charAt(i);
}
Arrays.sort(b);
String s2=new String(b);
char c[]= new char[5];
for(int i=0;i<5;i++){
c[i]=s.charAt(i);
}
Arrays.sort(c);
String s1=new String(c);
if(s2.equals(s1))
System.out.println("YES");
else
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
2db0c6ceab76fb5816f02b4770c76560
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;
public class Application {
public static void main(String[] somethingstrangewithme) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
for ( int i = 0; i < n; i ++ ) {
int m = scan.nextInt();
String name = scan.next();
if ( name.contains("T") && name.contains("i") && name.contains("m") && name.contains("u") && name.contains("r") && name.length() == 5 )
System.out.println("YES");
else
System.out.println("NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
20223fdf80ee30ba59aef5fc8ee34324
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;
public class Study{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a;
String s;
for (int i = 0; i < n; i++) {
a = sc.nextInt();
s = sc.next();
if(a != 5) System.out.println("No");
else{
if(s.contains("T") && s.contains("i") && s.contains("m") && s.contains("u") && s.contains("r")){
System.out.println("Yes");
}else System.out.println("No");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
7dc81170c39baeb01ac583e2f6712975
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.jar.Attributes;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskA solver = new TaskA();
solver.solve(1, in, out);
out.close();
}
static class TaskA {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int T = in.nextInt();
while (T -- > 0){
int n = in.nextInt();
String a = in.next();
if(n != 5)
System.out.println("NO");
else{
char [] c = a.toCharArray();
Arrays.sort(c);
if(c[0] == 'T' && c[1] == 'i' && c[2] == 'm' && c[3]== 'r' && c[4] == 'u'){
System.out.println("YES");
}else
System.out.println("NO");
}
}
}
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public double nextDouble(){
return Double.parseDouble(next());
}
public long nextLong(){
return Long.parseLong(next());
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
347145ee8e5213056ff0e70378002ca5
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.*;
import java.util.*;
public class SpellCheck {
public static PrintWriter out;
public static void main(String[] args)throws IOException {
JS sc=new JS();
out = new PrintWriter(System.out);
int t=sc.nextInt();
while(t-->0) {
int n=sc.nextInt();
String s=sc.next();
HashSet<Character>hs=new HashSet<>();
for(int i=0;i<n;i++) {
hs.add(s.charAt(i));
}
if(hs.contains('T')&&hs.contains('i')&&hs.contains('m')&&hs.contains('u')&&hs.contains('r')&&n==5) {
out.println("YES");
}else {
out.println("NO");
}
}
out.close();
}
static class JS {
public int BS = 1<<16;
public char NC = (char)0;
byte[] buf = new byte[BS];
int bId = 0, size = 0;
char c = NC;
double num = 1;
BufferedInputStream in;
public JS() {
in = new BufferedInputStream(System.in, BS);
}
public JS(String s) throws FileNotFoundException {
in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
}
public char nextChar(){
while(bId==size) {
try {
size = in.read(buf);
}catch(Exception e) {
return NC;
}
if(size==-1)return NC;
bId=0;
}
return (char)buf[bId++];
}
public int nextInt() {
return (int)nextLong();
}
public long nextLong() {
num=1;
boolean neg = false;
if(c==NC)c=nextChar();
for(;(c<'0' || c>'9'); c = nextChar()) {
if(c=='-')neg=true;
}
long res = 0;
for(; c>='0' && c <='9'; c=nextChar()) {
res = (res<<3)+(res<<1)+c-'0';
num*=10;
}
return neg?-res:res;
}
public double nextDouble() {
double cur = nextLong();
return c!='.' ? cur:cur+nextLong()/num;
}
public String next() {
StringBuilder res = new StringBuilder();
while(c<=32)c=nextChar();
while(c>32) {
res.append(c);
c=nextChar();
}
return res.toString();
}
public String nextLine() {
StringBuilder res = new StringBuilder();
while(c<=32)c=nextChar();
while(c!='\n') {
res.append(c);
c=nextChar();
}
return res.toString();
}
public boolean hasNext() {
if(c>32)return true;
while(true) {
c=nextChar();
if(c==NC)return false;
else if(c>32)return true;
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
0c44cef7124deb955c7bc9989a35e0fe
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Solution {
public static String isValid(String s,int n) {
char ch = 0;
if(n!=5)
return "NO";
int cnt=0;
int cnt1=0;
for(int i=0;i<n;i++) {
if(Character.isUpperCase(s.charAt(i))) {
cnt++;
ch=s.charAt(i);
}
}
//System.out.println(ch);
if(cnt==1 && ch!='T' || cnt==0 || cnt>1)
return "NO";
Map<Character,Integer> map=new LinkedHashMap<>();
for(int i=0;i<n;i++) {
if(!map.containsKey(s.charAt(i)))
map.put(s.charAt(i),1);
else
map.put(s.charAt(i), map.get(s.charAt(i))+1);
}
//System.out.println(map);
for(Map.Entry<Character, Integer> m:map.entrySet()) {
if(m.getKey()=='T' && m.getValue()==1 || m.getKey()=='i' && m.getValue()==1
|| m.getKey()=='m' && m.getValue()==1 || m.getKey()=='u' && m.getValue()==1 ||
m.getKey()=='r' && m.getValue()==1) {
cnt1++;
}
}
//System.out.println(cnt1);
if(cnt1!=5)
return "NO";
return "YES";
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0) {
int n=sc.nextInt();
String s=sc.next();
System.out.println(isValid(s,n));
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
d08974fa11d5368265642cb000080277
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
//package codeforces;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.StringTokenizer;
public class A {
static HashSet<String> set = new HashSet<>();
public static void main(String[] args){
FastReader sc = new FastReader();
int t = sc.nextInt();
// set.add('T');set.add('i');
// set.add('m');set.add('u');
// set.add('r');
permute("Timur","");
StringBuffer sb = new StringBuffer();
while (t-->0){
int n = sc.nextInt();
String str = sc.next();
if (n != 5){
sb.append("NO").append("\n");
continue;
}
// boolean re = true;
// for (char ch : str.toCharArray()){
// if (!set.contains(ch)){
// sb.append("NO").append("\n");
// re=false;
// break;
// }
// }
// if (re) sb.append("YES").append("\n");
if (set.contains(str)){
sb.append("YES").append("\n");
}else{
sb.append("NO").append("\n");
}
}
System.out.print(sb.toString());
}
static void permute(String s , String answer) {
if (s.length() == 0) {
set.add(answer);
return;
}
for(int i = 0 ;i < s.length(); i++) {
char ch = s.charAt(i);
String left_substr = s.substring(0, i);
String right_substr = s.substring(i + 1);
String rest = left_substr + right_substr;
permute(rest, answer + ch);
}
}
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
a4f0ef8c2d4fa19d6814d572ea45fa46
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.io.*;
public class solve{
public static void main(String [] args){
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
ArrayList<String> list = new ArrayList<>();
sol("Timur","",list);
for(int i=1 ; i<=t ; i++){
int n = scan.nextInt();
String s = scan.next();
if(list.contains(s)) System.out.println("YES");
else System.out.println("NO");
}
}
public static void sol(String s , String ans , ArrayList<String> list){
if(s.length()==0) {list.add(ans); ans =""; return;}
for(int i=0 ; i<s.length() ; i++){
char ch = s.charAt(i);
String left = s.substring(0,i);
String right = s.substring(i+1);
sol(left+right,ans+ch,list);
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
ffc98da0e08b1d6a6bf31e79ec47dc30
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
/**
* @author :Changersh
* @date : 2022/8/30
*/
import java.io.*;
import java.util.*;
import java.lang.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while (T-- > 0) {
int n = sc.nextInt();
char[] s = sc.next().toCharArray();
if (n != 5) {
System.out.println("No");
continue;
}
Arrays.sort(s);
if (check(s)) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
static private boolean check(char[] s) {
char[] t = {'T', 'i', 'm', 'r', 'u'};
for (int i = 0; i < 5; i++) {
if (s[i] != t[i]) return false;
}
return true;
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
e127079de36850228d0f51b255ddb8fc
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Palindrome
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int n=sc.nextInt();
sc.nextLine();
String s=sc.nextLine();
String a="Timur";
int cnt=0;
List<String> l=new ArrayList();
perm(a,a.length(),0,"",l);
//System.out.println(l);
if(s.length()!=a.length())
{
System.out.println("NO");
}
else
{
for(int i=0;i<l.size();i++)
{
if(s.compareTo(l.get(i))==0)
{
System.out.println("YES");
cnt=1;
break;
}
}
if(cnt==0)
System.out.println("NO");
}
}
}
public static void perm(String s,int n,int idx,String ans,List<String> lt)
{
if(idx==n){
lt.add(ans);
return;
}
for(int i=0;i<s.length();i++)
{
char c=s.charAt(i);
perm(s.substring(0,i)+s.substring(i+1,s.length()),n,idx+1,ans+c,lt);
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
d4ff695d1a1b0b453ac35421696391bf
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.io.*;
public class Main
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int n=sc.nextInt();
String s=sc.next();
char[] c=s.toCharArray();
List<Character> l=new ArrayList<>();
for(int i=0;i<n;i++)
{
l.add(s.charAt(i));
}
if(l.contains('T') && l.contains('i') && l.contains('m') && l.contains('u') && l.contains('r') && l.size()==5)
{
System.out.println("YES");
}
else
{
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
14835c85bb603eea738bd93abb75d969
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.*;
import java.util.*;
public class SpellCheck {
public static void main(String[] args) {
try {
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
int testcases = in.nextInt();
while (testcases-- > 0) {
int[] freq = new int[200];
int n = in.nextInt();
String curr = in.next();
for (int i = 0; i < n; i++)
freq[curr.charAt(i) - 65]++;
//dbg(freq);
boolean istrue = true;
if (freq['T' - 65] != 1)
istrue = false;
if (freq['i' - 65] != 1)
istrue = false;
if (freq['m' - 65] != 1)
istrue = false;
if (freq['u' - 65] != 1)
istrue = false;
if (freq['r' - 65] != 1)
istrue = false;
if (istrue&&n==5)
out.println("Yes");
else
out.println("No");
}
out.close();
} catch (Exception e) {
// TODO: handle exception
return;
}
}
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
int[] readArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
long[] readLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
String nextLine() {
String str = "";
try {
str = br.readLine().trim();
} catch (Exception e) {
e.printStackTrace();
}
return str;
}
}
static boolean LOCAL = System.getProperty("ONLINE_JUDGE") == null;
static void dbg(Object... o) {
if (LOCAL)
System.err.println(Arrays.deepToString(o));
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
ce22075bc8365443ec49b104637a5aa4
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args) throws IOException {
Fast f = new Fast(System.in);
int t = f.nextInt();
while (t-- != 0) {
int n = f.nextInt();
String s = f.next();
if(s.contains("T") && s.contains("i") && s.contains("m") && s.contains("u") && s.contains("r") && s.length()==5)
System.out.println("YES");
else
System.out.println("NO");
}
System.out.flush();
System.out.close();
}
}
class Fast {
StringTokenizer st;
BufferedReader br;
public Fast(InputStream s) {
br = new BufferedReader(new InputStreamReader(s));
}
public Fast(String file) throws IOException {
br = new BufferedReader(new FileReader(file));
}
public Fast(FileReader r) {
br = new BufferedReader(r);
}
public String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public String readAllLines(BufferedReader reader) throws IOException {
StringBuilder content = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
content.append(line);
content.append(System.lineSeparator());
}
return content.toString();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public long nextLong() throws IOException {
return Long.parseLong(next());
}
public int[] nextIntArray(int n) throws IOException {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public boolean ready() throws IOException {
return br.ready();
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
76c62a5dc26061aa0e0bf93aa5d9c08e
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
String x="Timur";
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
sc.nextLine();
HashSet<Character> st=new HashSet<>();
for(char ch:x.toCharArray()){
st.add(ch);
}
String s=sc.nextLine();
String ans="YES";
if(s.length()!=x.length()){
ans="NO";
}else{
for(char ch:s.toCharArray()){
if(!st.contains(ch)){
ans="NO";
break;
}else{
st.remove(ch);
}
}
}
System.out.println(ans);
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
59d1fda3f1ce3fce8ee0d2d2ee87207a
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
public class Main{
static Scanner scn;
public static void main(String[] args){
scn = new Scanner(System.in);
int t = scn.nextInt();
while(t-- > 0){
int wordLen = scn.nextInt();
scn.nextLine();
String str1 = scn.nextLine();
String pattern = "Timru";
char[] patternArr = pattern.toCharArray();
char[] strArr = str1.toCharArray();
Arrays.sort(strArr);
// Arrays.sort(patternArr);
System.out.println(Arrays.equals(patternArr, strArr) ? "YES" : "NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
eff7a5a550743d4dbd63073882c05222
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
public class Main{
static Scanner scn;
public static void main(String[] args){
scn = new Scanner(System.in);
int t = scn.nextInt();
while(t-- > 0){
int wordLen = scn.nextInt();
scn.nextLine();
String str1 = scn.nextLine();
String pattern = "Timur";
char[] patternArr = pattern.toCharArray();
char[] strArr = str1.toCharArray();
Arrays.sort(strArr);
Arrays.sort(patternArr);
System.out.println(Arrays.equals(patternArr, strArr) ? "YES" : "NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
09f3ce393622034527a9a00e10ffb767
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
public class Main{
static Scanner scn;
public static void main(String[] args){
scn = new Scanner(System.in);
int t = scn.nextInt();
while(t-- > 0){
int wordLen = scn.nextInt();
scn.nextLine();
String str1 = scn.nextLine();
HashMap<Character, Integer> hm = new HashMap<>();
for(char ch : str1.toCharArray()){
hm.put(ch, hm.getOrDefault(ch, 0)+1);
}
String pattern = "Timur";
// System.out.println("the hs is"+ hs);
boolean ans = hm.size() == 5;
for(int i = 0; i < pattern.length() && ans; i++){
char ch = pattern.charAt(i);
if( !hm.containsKey(ch) || hm.get(pattern.charAt(i)) > 1) ans = false;
}
if(ans)
System.out.println("YES");
else
System.out.println("NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
62025dc5a247e6f879098f0cdd4ed405
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
char a[] = {'T','i','m','r','u'};
Scanner sc = new Scanner(System.in);
int te = sc.nextInt();
for(int t=0;t<te;t++)
{
int c[] = new int[5];
int n = sc.nextInt();
String na = sc.next();
if(na.length() == 5)
{
char naa[] = na.toCharArray();
for(int i=0;i<na.length();i++)
{
for(int j=0;j<a.length;j++)
{
if(naa[i] == a[j])
{
c[j] = c[j] + 1;
}
}
}
int count = 0;
for(int i=0;i<c.length;i++)
{
if(c[i] == 1)
{
count++;
}
else{
System.out.println("NO");
break;
}
}
if(count == 5)
{
System.out.println("YES");
}
}
else{
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
e1517d592d155a3e42f8014a516a6b35
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.HashSet;
import java.util.*;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
int n=scn.nextInt();
HashSet<Character>has=new HashSet<>();
has.add('T');
has.add('i');
has.add('m');
has.add('u');
has.add('r');
while (n>0){
int a=scn.nextInt();
String sc = scn.next();
Arrays.sort(sc.toCharArray());
if(a!=5){
System.out.println("NO");
}else {
HashSet<Character>h=new HashSet<>();
boolean is = false;
for (int i = 0; i < 5; i++) {
char sac = sc.charAt(i);
if (has.contains(sac) != true){
is = true;
break;
}else {
h.add(sac);
}
}
if (is == true) {
System.out.println("NO");
} else {
if(has.size()==h.size()) {
System.out.println("YES");
}else {
System.out.println("NO");
}
}
}
n--;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
41b047656d4637c88363043f78d3713e
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
for (int zz = 0; zz < t; zz++) {
int n = in.nextInt();
String s = in.next();
if (n != 5) {
System.out.println("NO");
}else {
if (s.contains("T") && s.contains("i") && s.contains("u") && s.contains("m") && s.contains("r")) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
314d5993c96ecc0dd05eb8fe131afa7e
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.io.*;
public class solve{
public static void main (String[] args) {
int T=sc.nextInt();
while(T--!=0) {
int n=sc.nextInt();
String s=sc.next();
String s1=s.toLowerCase();
if(s.length()==5 && s.contains("T") && s.contains("i")
&& s.contains("m") && s.contains("u") && s.contains("r"))
{
System.out.println("YES");
}
else
{
System.out.println("NO");
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
out.flush();out.close();
}
//END OF MAIN METHOD.
static boolean isPrime(long n)
{
// Check if number is less than
// equal to 1
if (n <= 1)
return false;
// Check if number is 2
else if (n == 2)
return true;
// Check if n is a multiple of 2
else if (n % 2 == 0)
return false;
// If not, then just check the odds
for (int i = 3; i <= Math.sqrt(n); i += 2)
{
if (n % i == 0)
return false;
}
return true;
}
/*
//IMPORTANT AND NEW METHODS.
1.Sort on basis of first key
:Arrays.sort(a,(a,b)->a[0]-b[0]);
2.Sort on basis of 1st key and if equal compare and sort according to second key.
:Arrays.sort(a,(x,y)->x[0]==y[0]?Integer.compare(x[1], y[1]):Integer.compare(x[0], y[0]));
3.SLIDING WINDOW APPROACH
:Variable size - condition given we have to maximize the size of window.
:Fixed size - maximize the sum with window size of k.
4.Calculate no of digits in N
:No. of digits in N = Math.floor(Math.log10(N)) + 1;
5.Multiply any number by two or divide by two
: n = n << 1; // Multiply n with 2
: n = n >> 1; // Divide n by 2
6.To check weather it divisible by two or not
:n&1==1// divisible by two
:n$1==0// not divisible by two
*/
//Filling map with frequency of array elements
static Map<Integer, Integer> map(int[] a) {
Map<Integer,Integer> map=new HashMap<>();
for(int i:a){
map.put(i,map.getOrDefault(i,0)+1);
}
return map;
}
//factorial of n
static double fact(double n)
{
int i=1;
double fact=1;
while(i<=n)
{
fact=fact*i;
i++;
}
return fact;
}
//Calculate the nCr
static int nCr(int n,int r)
{
double com=fact(n)/(fact(n-r)*fact(r));
return (int)com;
}
//Calculate the nPr
static int nPr(int n, int r)
{
return (int) (fact(n) / fact(n - r));
}
//checks power of two
static boolean powerTwo(long x)
{
return x!=0 && ((x&(x-1)) == 0);
}
//swap two numbers
static void swap(int a,int b) {
a ^= b;
b ^= a;
a ^= b;
}
static final Random random = new Random();
static class FastScanner {
public long[][] readArrayL;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=new StringTokenizer("");
String next() {
while (!st.hasMoreTokens())
try {
st=new StringTokenizer(br.readLine());
} catch (IOException e) {e.printStackTrace();
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long[] Arrayl(int n) {
long a[]=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
int[] Array(int n) {
int[] a=new int[n];
for (int i=0; i<n; i++) a[i]=nextInt();
return a;
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
}
static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
static FastScanner sc = new FastScanner();
}//END OF MAIN CLASS.
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
1684ade9d693422ec0e381c72d73a2f4
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;public class Main { public static void main(String[] args) {Scanner in = new Scanner(System.in);int t = in.nextInt();while (t--!=0) {int n = in.nextInt();String s = in.next();System.out.println((s.contains("T") && s.contains("i") && s.contains("m") && s.contains("u") && s.contains("r") && s.length() == 5)?"YES":"NO");}}}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
3404c18035066fe93b68306001447753
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
public class JavaApplication14 {
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader()
{
din = new DataInputStream(System.in);
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public Reader(String file_name) throws IOException
{
din = new DataInputStream(
new FileInputStream(file_name));
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public String readLine() throws IOException
{
byte[] buf = new byte[64]; // line length
int cnt = 0, c;
while ((c = read()) != -1) {
if (c == '\n') {
if (cnt != 0) {
break;
}
else {
continue;
}
}
buf[cnt++] = (byte)c;
}
return new String(buf, 0, cnt);
}
public int nextInt() throws IOException
{
int ret = 0;
byte c = read();
while (c <= ' ') {
c = read();
}
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public long nextLong() throws IOException
{
long ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public double nextDouble() throws IOException
{
double ret = 0, div = 1;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (c == '.') {
while ((c = read()) >= '0' && c <= '9') {
ret += (c - '0') / (div *= 10);
}
}
if (neg)
return -ret;
return ret;
}
private void fillBuffer() throws IOException
{
bytesRead = din.read(buffer, bufferPointer = 0,
BUFFER_SIZE);
if (bytesRead == -1)
buffer[0] = -1;
}
private byte read() throws IOException
{
if (bufferPointer == bytesRead)
fillBuffer();
return buffer[bufferPointer++];
}
public void close() throws IOException
{
if (din == null)
return;
din.close();
}
}
public static void main(String[] args) throws IOException {
Reader scan=new Reader();
int t=scan.nextInt();
while(t-->0){
int n=scan.nextInt();
String s=scan.readLine();
if(n==5)
{
boolean f1=false,f2=false,f3=false,f4=false,f5=false;
for(int i=0;i<s.length();i++)
{
char c=s.charAt(i);
if(c=='T')
f1=!f1;
else if(c=='i')
f2=!f2;
else if(c=='m')
f3=!f3;
else if(c=='u')
f4=!f4;
else if(c=='r')
f5=!f5;
}
if(f1&&f2&&f3&&f4&&f5)
System.out.println("yes");
else
System.out.println("no");
}
else
System.out.println("no");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
cc92806781b884545f1157612e4cb42e
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Arrays;
import java.util.Scanner;
public class DesProgram{
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = Integer.parseInt(sc.nextLine());
while(t-- > 0) {
String ss = "Timur";
int n =Integer.parseInt(sc.nextLine());
String s = sc.nextLine();
if(s.length() != ss.length()) {
System.out.println("NO");
continue;
}
char[] ch = s.toCharArray();
char[] c = ss.toCharArray();
Arrays.sort(ch);
Arrays.sort(c);
boolean got = true;
for(int i = 0; i < ss.length(); i++) {
if(ch[i] != c[i]) {
got = false;
break;
}
}
if(got) {
System.out.println("Yes");
}else {
System.out.println("NO");
}
}
sc.close();
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
f8e6b2168033265ac8e6f0285d966c8c
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.HashMap;
import java.util.Scanner;
public class Timur {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
HashMap<Character, Integer> hs = new HashMap<>();
hs.put('T', 1);
hs.put('i',1);
hs.put('m',1);
hs.put('u',1);
hs.put('r',1);
while(t-- > 0){
int l = sc.nextInt();
String s = "";
sc.nextLine();
if(sc.hasNext())
s= sc.nextLine();
HashMap<Character, Integer> map = new HashMap<>();
for(int i = 0; i < l; i++){
map.put(s.charAt(i), 1);
}
if(map.equals(hs) && map.size() == l){
System.out.println("YES");
}else {
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
356b977e471daa3cbae5b19d2a6e2849
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
/* package codechef; // don't place package name! */
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.*;
// Remember that the class name should be "Main" and should be "public".
public class Main {
public static void main(String[] args) {
// System.in and System.out are input and output streams, respectively.
InputStream inputStream = System.in;
InputReader in = new InputReader(inputStream);
// Read the number of test casese.
int T = in.nextInt();
while (T-- > 0) {
// Read the numbers a and b.
int n = in.nextInt();
String s ="Timur";
String str=in.next();
if(n!=5){
System.out.println("NO");
continue;
}
int a=0;
int b=0;
for(int i=0;i<str.length();i++){
int ch=(int)str.charAt(i);
if(ch>=65 && ch<=90){
a++;
}
else if(ch>=97 && ch<=122){
b++;
}
}
boolean flag=false;
char[] ch1 = str.toCharArray();
char[] ch2 = s.toCharArray();
Arrays.sort(ch1);
Arrays.sort(ch2);
for(int i =0;i<ch1.length;i++){
if(ch1[i]!=ch2[i]){
flag=true;
break;
}
}
if(flag){
System.out.println("NO");
}
else{
System.out.println("YES");
}
}
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
4c160da34ffe71eadbf6379a6997831a
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.Scanner;
public class SpellCheckA {
static Scanner sc = new Scanner(System.in);
static int count=0;
static boolean solve(int n, String s){
boolean flag=true;
boolean br = false;
count=0;
if(n!=5)
{
flag=false;
return flag;
}
else
{
for(int i=0; i<n; ++i){
if(s.charAt(i)=='T' || s.charAt(i)=='i' ||s.charAt(i)=='m' || s.charAt(i)=='u' || s.charAt(i)=='r')
{
for(int j=0;j<i;++j)
{
if(s.charAt(i)==s.charAt(j))
{
br = true;
break;
}
}
if(br)
{
count = 0;
break;
}
else{
++count;
}
}
}
if(count !=5)
{
flag = false;
}
return flag;
}
}
public static void main(String[] args) {
int T = sc.nextInt();
for (int i = 0; i <T; ++i)
{
int n = sc.nextInt();
String s = sc.next();
if(solve(n, s))
{
System.out.println("YES");
}
else
{
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
b4a4bf70cce38e40f29f495fa2d8a698
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t!=0){
int l=sc.nextInt();
String s=sc.next();
if(l!=5){ System.out.println("No");
t--;
continue;}
int T=1;
int I=1; int m=1; int u=1; int r=1;
for(int i=0;i<s.length();i++){
char c=s.charAt(i);
if(c=='T') T--;
else if(c=='i') I--;
else if(c=='m') m--;
else if(c=='u') u--;
else if(c=='r') r--;
}
if (T==0 && I==0 && m==0 && u==0 && r==0)
System.out.println("Yes");
else
System.out.println("No");
t--;
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
67df752797ddd6473637c376cf48f235
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.lang.*;
import java.util.*;
public class demo{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int t = sc.nextInt();
for(int i = 0 ; i < t ; i ++ ){
int n=sc.nextInt();
String s=sc.next();
if(n==5){
String demo="Timur";
int flag=0;
for(int j=0;j<n;j++){
int c=0;
for(int z=0 ; z<n ;z++){
if(s.charAt(z)==demo.charAt(j)){
c++;
}
}
if(c!=1){
System.out.println("no");
flag=1;
break;
}
}
if(flag==0)
System.out.println("yes");
}
else
System.out.println("no");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
643914746005afe7b56147ffefe7b581
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
String str1 = "Timur";
char[] c1 = str1.toCharArray();
Arrays.sort(c1);
while(t-->0){
int n = s.nextInt();
String str2 = s.next();
char[] c2 = str2.toCharArray();
Arrays.sort(c2);
boolean result = Arrays.equals(c1,c2);
if(result){
System.out.println("Yes");
}
else{
System.out.println("No");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
ee32ef0dac592b821bd24211ae7c4f44
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.lang.*;
import java.io.IOException;
import java.io.InputStreamReader;
import java.security.spec.RSAOtherPrimeInfo;
import java.util.*;
public class SEC {
static long mod = (long) (1e9 + 7);
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
static void sort(long[] arr) {
ArrayList<Long> a = new ArrayList<>();
for (long i : arr) {
a.add(i);
}
Collections.sort(a);
for (int i = 0; i < a.size(); i++) {
arr[i] = a.get(i);
}
}
static long highestPowerof2(long x) {
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
return x ^ (x >> 1);
}
public static long fact(long number) {
if (number == 0 || number == 1) {
return 1;
} else {
return number * fact(number - 1);
}
}
public static ArrayList<Long> primeFactors(long n) {
ArrayList<Long> arr = new ArrayList<>();
long count = 0;
while (n % 2 == 0) {
arr.add(2l);
n /= 2;
}
for (long i = 3; i <= Math.sqrt(n); i += 2) {
while (n % i == 0) {
arr.add(i);
n /= i;
}
}
if (n > 2)
arr.add(n);
return arr;
}
static public long[] prime(long number) {
long n = number;
long count = 0;
long even = 0;
for (long i = 2; i <= n / i; i++) {
while (n % i == 0) {
if (i % 2 == 1) {
count++;
} else {
even++;
}
n /= i;
}
}
if (n > 1) {
if (n % 2 == 1) {
count++;
} else {
even++;
}
}
return new long[]{even, count};
}
static void swap(int[] arr, int i, int j) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
static int search(ArrayList<Integer> arr, int tar) {
int low = 0, hi = arr.size() - 1;
int ans = -1;
while (low <= hi) {
int mid = (low + hi) / 2;
if (arr.get(mid) > tar) {
ans = arr.get(mid);
hi = mid - 1;
} else {
low = mid + 1;
}
}
return ans;
}
static long gcd(long a, long b) {
// if b=0, a is the GCD
if (b == 0)
return a;
else
return gcd(b, a % b);
}
static long power(long x, long y, long p) {
long res = 1;
x = x % p;
if (x == 0)
return 0;
while (y > 0) {
if ((y & 1) != 0)
res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
static int get(long[] arr, long tar) {
int ans = -1;
int l = 0;
int h = arr.length - 1;
while (l <= h) {
int mid = l + (h - l) / 2;
if (arr[mid] <= tar) {
ans = mid;
l = mid + 1;
} else {
h = mid - 1;
}
}
return ans;
}
static void print_Array(int[] arr) {
for (int i : arr) {
System.out.print(i + " ");
}
System.out.println();
}
static boolean con(char ch) {
if (ch != 'a' && ch != 'e' && ch != 'i' && ch != 'o' && ch != 'u') return true;
return false;
}
static void swap(char[] ch, int i, int j) {
char c = ch[i];
ch[i] = ch[j];
ch[j] = c;
}
static void swap(long[] ch, int i, int j) {
long c = ch[i];
ch[i] = ch[j];
ch[j] = c;
}
public static void main(String[] args) throws Exception {
FastReader sc = new FastReader();
int t = sc.nextInt();
while(t-- > 0){
int n = sc.nextInt();
char[] ch = sc.next().toCharArray();
if(n > 5){
System.out.println("NO");
continue;
}
boolean ans = true;
int c = 0;
String spell = "Timur";
outer: for(int i = 0; i < spell.length(); i++){
for(int j = 0; j < n; j++){
if(spell.charAt(i) == ch[j]){
c++;
continue outer;
}
}
}
System.out.println(c == 5 ? "YES": "NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
9d261855ee38e4f933755065abeaf907
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
import java.io.*;
public class Balabizoo {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int tt = sc.nextInt();
char[] a = {'T', 'i', 'm', 'u', 'r'};
HashSet<Character> hs = new HashSet<>();
for (int i = 0; i < a.length; i++)
hs.add(a[i]);
while (tt-- > 0) {
int n = sc.nextInt();
char[] c = sc.next().toCharArray();
if (n != 5)
pw.println("NO");
else {
boolean f = true;
HashSet<Character> tmp = new HashSet<>();
for(char x : c)
tmp.add(x);
for(char x : hs)
if(!tmp.contains(x))
f = false;
pw.println(f? "YES" : "NO");
}
}
pw.flush();
}
static class Scanner {
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream s) {
br = new BufferedReader(new InputStreamReader(s));
}
public Scanner(String file) throws IOException {
br = new BufferedReader(new FileReader(file));
}
public Scanner(FileReader r) {
br = new BufferedReader(r);
}
public String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public String readAllLines(BufferedReader reader) throws IOException {
StringBuilder content = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
content.append(line);
content.append(System.lineSeparator());
}
return content.toString();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public long nextLong() throws IOException {
return Long.parseLong(next());
}
public String nextLine() throws IOException {
return br.readLine();
}
public double nextDouble() throws IOException {
String x = next();
StringBuilder sb = new StringBuilder("0");
double res = 0, f = 1;
boolean dec = false, neg = false;
int start = 0;
if (x.charAt(0) == '-') {
neg = true;
start++;
}
for (int i = start; i < x.length(); i++)
if (x.charAt(i) == '.') {
res = Long.parseLong(sb.toString());
sb = new StringBuilder("0");
dec = true;
} else {
sb.append(x.charAt(i));
if (dec)
f *= 10;
}
res += Long.parseLong(sb.toString()) / f;
return res * (neg ? -1 : 1);
}
public long[] nextlongArray(int n) throws IOException {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
public Long[] nextLongArray(int n) throws IOException {
Long[] a = new Long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
public int[] nextIntArray(int n) throws IOException {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public Integer[] nextIntegerArray(int n) throws IOException {
Integer[] a = new Integer[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public boolean ready() throws IOException {
return br.ready();
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
48022ab4826cb6fe75a230cba57d7b3f
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.util.*;
public class Contest1722 {
public static void main(String[] args) {
new Contest1722().solveA();
}
Scanner in;
private void solveA() {
in = new Scanner(System.in);
int t = in.nextInt();
while (t-- > 0) {
int n = in.nextInt();
char[] name = in.next().toCharArray();
System.out.println(n != 5 ? "NO" : checkName(name) ? "YES" : "NO");
}
}
private boolean checkName(char[] name) {
List<Character> listActual = new ArrayList<>(Arrays.asList('T', 'i', 'm', 'u', 'r'));
List<Character> list = new ArrayList<>();
for (char character: name) {
list.add(character);
}
return new HashSet<>(list).containsAll(listActual);
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
f3bb309f9441a157c66f947da3e1a84e
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class R817A {
public static void main(String[] args)throws IOException {
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(in.readLine());
while(n-->0){
int l=Integer.parseInt(in.readLine());
char[] s=in.readLine().toCharArray();
if(l!=5){
System.out.println("NO");
continue;
}
Arrays.sort(s);
if(s[0]=='T'&&s[1]=='i'&&s[2]=='m'&&s[3]=='r'&&s[4]=='u'){
System.out.println("YES");
}else{
System.out.println("NO");
}
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
| |
PASSED
|
e6e47237e565b18aff26e670f8c50a5b
|
train_109.jsonl
|
1661871000
|
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.Today he wrote string $$$s$$$ of length $$$n$$$ consisting only of uppercase or lowercase Latin letters. He asks you to check if $$$s$$$ is the correct spelling of his name.
|
256 megabytes
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CodeForce_1722_A {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(read.readLine());
for (int test = 0; test < T; test++) {
int N = Integer.parseInt(read.readLine());
String templine = read.readLine();
if (N != 5) {
System.out.println("NO");
continue;
}
if (templine.contains("T") && templine.contains("i") && templine.contains("m") && templine.contains("u")
&& templine.contains("r"))
System.out.println("YES");
else
System.out.println("NO");
}
}
}
|
Java
|
["10\n\n5\n\nTimur\n\n5\n\nmiurT\n\n5\n\nTrumi\n\n5\n\nmriTu\n\n5\n\ntimur\n\n4\n\nTimr\n\n6\n\nTimuur\n\n10\n\ncodeforces\n\n10\n\nTimurTimur\n\n5\n\nTIMUR"]
|
1 second
|
["YES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO"]
| null |
Java 8
|
standard input
|
[
"implementation"
] |
6c137a74b36dede61037cb3b05167329
|
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10)$$$ — the length of string $$$s$$$. The second line of each test case contains a string $$$s$$$ consisting of only uppercase or lowercase Latin characters.
| 800
|
For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
|
standard output
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.