Computer Science, asked by nandujk26, 2 days ago

Given, an initial string s and a final string t. A game played with strings which lasts for k seconds has the following rules to be followed:
1. For each i from 1 to k, any index from string s is picked and character at that index is shifted i units to the right. The shift is circular, that is if z is shifted 1 unit, it becomes a.
2. Any index can be picked at most once. Write a program to identify if string t can be achieved from string using the rules.

Input format
• The first line of Input consists of string s.
• The second line consists of string t (having the same length as s).
• The last line consists of an integer k.

Output format
Print "Yes" if string t can be achieved from string s using the given rules else print "No".​

Answers

Answered by shilpa85475
0

The first line of Input consists of string s.

• The second line consists of string t (having the same length as s).

• The last line consists of an integer k.

Output:

Yes/No

Explanation:

public class abc

{

static String abc(int x1, int v1, int x2, int v2)

{

 if (v1 > v2) {

  int remainder = (x1 - x2) % (v2 - v1);

  if (remainder == 0) {

   return "YES";

  }

 }

 return "NO";

}

public static void main(String[] args) {

 Scanner in = new Scanner(System.in);

 int x1 = in.nextInt();

 int v1 = in.nextInt();

 int x2 = in.nextInt();

 int v2 = in.nextInt();

 System.out.println(kangaroo(x1, v1, x2, v2));

 in.close();

}

}

Answered by ankit9690026738
0

Answer:

abc

DDD

aaaakkkkajjjajjja

Similar questions