Solve the 19th question. Construct a Turing Machine for the following function a
ID: 3721171 • Letter: S
Question
Solve the 19th question. Construct a Turing Machine for the following function and show an accepting sequence of configurations using an example string
230 Turing Macin 10.12 Exercises 19. Implement a simple tokenizer: given a string with single blank spaces separating other 25. The Tu count the number of tokens in the string and output this number in unary. For exal Bver ab be abe bea abc a be the output shall be 20. Interleave two strings. Given two strings of equal length (separated by a single blank cell, uh a, b,b b...b the machine halts after writing on the tape an interleaved string composed of the first elemen of the two strings, followed by the second elements of the two strings, and so on, ending wih the last elements of the two strings, in that order: ababab,..a,b B. Make changes to the given Turing machine. Modify the Turing mhiuExplanation / Answer
PROGRAM
import java.*;
import java.util.*;
class a
{
public static void main(String args[])
{
Scanner ss=new Scanner(System.in);
String str;
int n,i;
str=ss.nextLine();
StringTokenizer st = new StringTokenizer(str);
System.out.println("OUTPUT");
System.out.print(str+" ");
n=st.countTokens();
for(i=1;i<=n;i++)
{
System.out.print(1);
}
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.