Computer Science, asked by vasuchourasia06200, 5 months ago


Find output generated by following codes?
x="one"
y="two"
C-0
white c<len(x):
paint (x[c],y[c])
C=C+I​

Answers

Answered by satindersinghchib78
1

Answer:

zsuf. 145385=66

hhhwhwhe+263745/:"+&_6jfir8hkd7yc676emgyhyrruttfyu6gf535068=][],,gug65yy

Answered by ssheetalsingh8962
0

Answer:

You are given a string S. Each character of S is either ‘a’, or ‘b’. You wish to reverse exactly one sub-string of S such that the new string is lexicographically smaller than all the other strings that you can get by reversing exactly one sub-string.

For example, given ‘abab’, you may choose to reverse the substring ‘ab’ that starts from index 2 (0-based). This gives you the string ‘abba’. But, if you choose the reverse the substring ‘ba’ starting from index 1, you will get ‘aabb’. There is no way of getting a smaller string, hence reversing the substring in the range [1, 2] is optimal.

Input

First line contains a number T, the number of test cases.

Each test case contains a single string S. The characters of the string will be from the set { a, b }.

Output

For each test case, print two numbers separated by comma; for example “x,y” (without the quotes and without any additional whitespace). “x,y” describe the starting index (0-based) and ending index respectively of the substring that must be reversed in order to achieve the smallest lexicographical string. If there are multiple possible answers, print the one with the smallest ‘x’. If there are still multiple answers possible, print the one with the smallest ‘y’.

Constraints

1 <= T <= 100

1 <= length of S <= 1000

Sample Input

5

abab

abba

bbaa

aaaa

babaabba

Sample Output

1,2

1,3

0,3

0,0

0,4

2) Given two strings I and F, where I is the initial state and F is the final state. Each state will contain ‘a’,’b’ and only one empty slot represented by ‘_’. Your task is to move from the initial state to the final state with the minimum number of operation.

Allowed operations are

Similar questions