## Problem with subscript on Word’s tables of content

For example, let’s look at figure 9.8:

In the TC field I can visualize subscripts perfectly. The question is: Why doesn’t this information replicate and appear unchanged on my index of figures (a Word table of content)?

## Reduction to proof undecidability of the problem: machine M and N accept infinitely many words

I am struggling with the following problem: Decide whether this problem is decidable or not: For two given Turing Machines M and N, there exists infinitely many words accepted by both machine M and machine N. In other words, is language `{ encodedMachine(M)#encodedMachine(N) | intersection of language of M and language of N is infinite }` decidable?

Intuitively it feels like this is undecidable problem and halting reduction might be used to proof this, but I have no idea how to start this reduction.

## Permutation of words in a sentence

There is a problem which discusses in how many ways can the words in a sentence be permuted . I wrote a code as follows which works for the sentences (I think so) . It would be helpful if anyone can assure me if it’s actually correct or not . Besides , any suggestion regarding the shortening of code or easing the logic is appreciated . Thanks…

``#include <stdio.h> #include <string.h>  int factorial(int x) {     if(x<=0) return 1;     else return x*factorial(x-1); };  int main(void) {     int T;//number of test cases     scanf("%d",&T);     while(T--){     char str[20];     scanf(" %[^\n]",str);     int i,j,k,m,count=0,l,p=1,n;     l=strlen(str);     //printf("%d\n",l);     for(i=0;i<l;i++){         if(str[i]==' '){             count++;         }     }//printf("%d\n",count);     m=count+1;//printf("%d\n",m);     char arr[m][50];     int check[m],func[m];     for(i=0,k=0,j=0;j<=l;j++){         //printf("%c\n",str[j]);         if(str[j]==' '||j==l){             check[i]=0;func[i]=1;             arr[i][k]='';             i++;             k=0;         }         else{             arr[i][k]=str[j];             k++;         }     }     for(i=0;i<m;i++){   for(j=i+1;j<m;j++){     if(check[i]==0&&strcmp(arr[i],arr[j])==0){         check[j]++;         func[i]++;     }   } } for(i=0;i<m;i++){     p*=factorial(func[i]); } n=factorial(m)/p; printf("%d/%d\n",1,n);    }  return 0; } ``

Input:

``       2         I eat rice         no game no life  ``

N.B.: The permutation within a word is to be ignored .

## Proofread Up To 5000 Words under 10Hours,1000 words for \$2 for \$10

This team provides exquisite proofreading services at the highest level. 5000 words can be completed in a professional standard under 10 hours. Max = 250,000 words ✪ – DEFAULT DELIVERY – 24 Hrs ✪ ★Deal Package needed for: All Orders over 1000 Words & Material To Be Published -First-Rate Editing, Repetitiveness Removal, Restructuring/Improving readability & sentence fluency★✈Select Priority Package Extra For Delivery < 10 Hours (Urgent Orders)This team works to ensure all deadlines are met. Try us, Love us, Share us. Specialties: Punctuation, grammar, readability, spelling and sentence fluencyRedundancy elimination Microsoft Track Changes used as standardMass projects - Novels, erotica, manuscripts, eBooks, articles, speeches, blogs, websites, business plans etcUK, US, AUS, CA English SpecialtyNo order is too large, Available 24/7 *NO WRITING/ REWRITING/ FORMATTING OF CONTENT IS OFFERED* NB: Please send us a personal message if you have a request of over 10,000 words. by: Michael02
Created: —
Viewed: 107

## I’ll write compelling quality content, article writing and blog post of 1000 words for your website for \$5

by: eddiemur25
Created: —
Category: Content & Writing
Viewed: 116

## Powershell script to find and replace words based on asset tag input

Can someone please help me modify this script to generate and modify the document faster? It currently takes about 5-10 seconds to create the variables. About 10 seconds for the entire script to run.

Here is the code for the script:

# Copy Word Template to Local C Drive:

``Copy-Item \172.16.0.75\allaccess\Scripts\transfer2.docx C:\ ``

# Create Replace-Word Function:

``function Replace-Word(     [string]\$  Document,     [string]\$  FindText,     [string]\$  ReplaceText ) {     \$  ReplaceAll = 2     \$  FindContinue = 1      \$  MatchCase = \$  false     \$  MatchWholeWord = \$  true     \$  MatchWildcards = \$  false     \$  MatchSoundsLike = \$  false     \$  MatchAllWordForms = \$  false     \$  Forward = \$  true     \$  Wrap = \$  FindContinue     \$  Format = \$  false      \$  Word = New-Object -ComObject Word.Application     \$  Word.Visible = \$  false      \$  OpenDoc = \$  Word.Documents.Open(\$  Document)     \$  Selection = \$  Word.Selection      \$  Selection.Find.Execute(         \$  FindText,         \$  MatchCase,         \$  MatchWholeWord,         \$  MatchWildcards,         \$  MatchSoundsLike,         \$  MatchAllWordForms,         \$  Forward,         \$  Wrap,         \$  Format,         \$  ReplaceText,         \$  ReplaceAll     ) | Out-Null      \$  OpenDoc.Close()     \$  Word.Quit() } ``

# Prompt user for information and generate several variables:

``\$  assettag = Read-Host -Prompt 'Input Asset Tag' \$  fullasset = id              : 3973 name              : XTX-L-25677 asset_tag         : 25677 serial            : XXXXXX model             : @{id=1440; name=Dell Latitude 5591} model_number      : eol               : @{date=2018-08-06; formatted=Aug 6, 2018} status_label      : @{id=6; name=Deployed; status_type=deployable; status_meta=deployed} category          : @{id=1; name=Laptop} manufacturer      : @{id=1; name=Dell} supplier          : @{id=6; name=Dell} notes             : order_number      : company           : @{id=2; name=SITE} location          : rtd_location      : @{id=287; name= Technology Division} image             : assigned_to       : @{id=2672; username=first; name=first last; first_name=First; last_name=last; warranty_months   : warranty_expires  : created_at        : @{datetime=2018-08-14 09:41:00; formatted=Aug 14, 2018 9:41AM} updated_at        : @{datetime=2019-06-11 10:23:38; formatted=Jun 11, 2019 10:23AM} last_audit_date   : next_audit_date   : deleted_at        : purchase_date     : @{date=2018-08-06; formatted=Aug 6, 2018} last_checkout     : @{datetime=2019-06-10 08:40:22; formatted=Jun 10, 2019 8:40AM} expected_checkin  : purchase_cost     : checkin_counter   : 2 checkout_counter  : 3 requests_counter  : 0 user_can_checkout : False custom_fields     : @{User=; Computer Type=; OS=; Memory=; Processor=; Wired MAC=; Wireless MAC=} available_actions : @{checkout=True; checkin=True; clone=True; restore=False; update=True; delete=True}  \$  model1,\$  serial,\$  location1,\$  category1,\$  status1 = (\$  fullasset).model,\$  fullasset).serial, (\$  location1).Name, (\$  fullasset).category, (\$  fullasset).category \$  model,\$  location,\$  category,\$  status = (\$  model1).Name,(\$  location1).Name,(\$  category1).Name,(\$  status1).name  \$  date = Get-Date -Format "M-dd-yy" \$  dom = \$  env:userdomain \$  usr = \$  env:username \$  name = ([ADSI]"WinNT://\$  dom/\$  usr,user").FullName \$  category = (\$  category1).Name \$  status = (\$  status1).Name ``

# Use generated variables and Replace-Word function to modify document:

``Replace-Word -Document C:\transfer2.docx -FindText '\$  assettag' -ReplaceText \$  assettag Replace-Word -Document C:\transfer2.docx -FindText '\$  model' -ReplaceText \$  model Replace-Word -Document C:\transfer2.docx -FindText '\$  location' -ReplaceText \$  location Replace-Word -Document C:\transfer2.docx -FindText '\$  date' -ReplaceText \$  date Replace-Word -Document C:\transfer2.docx -FindText '\$  serial' -ReplaceText \$  serial Replace-Word -Document C:\transfer2.docx -FindText '\$  x' -ReplaceText \$  x Replace-Word -Document C:\transfer2.docx -FindText '\$  status' -ReplaceText \$  status Replace-Word -Document C:\transfer2.docx -FindText '\$  category' -ReplaceText \$  category Replace-Word -Document C:\transfer2.docx -FindText '\$  name' -ReplaceText \$  name ``

Please let me know if there is anything I can consolidate or modify to improve speed.

## Cleaning words from numpy arrays

I’m a new joiner in a software engineering team and have been given this code for refactoring. This code feels very gluey and dependent to me but I can’t decide how to make it independent.

This is the code. The part which takes long time to execute is

``if order_counter is not None:     batch_inp = [(freq_cleaning_list[i:i+100000], \                   order_counter_cutoff, word_counter_cutoff)                  for i in range(0, len(freq_cleaning_list), 100000)] else:     batch_inp = [(freq_cleaning_list[i:i+100000], \                   word_counter_cutoff)                  for i in range(0, len(freq_cleaning_list), 100000)] ``

`cleaning_pipeline` class contains the code. I would be thankful to get some initial pointers to get started with this refactor. Thanks

## printing 2 words before and after a specific word in a file in python

What approach may i take for this question. I have an excel file which contains different sentences in every row. I want to look for a word in a row and print 2 words before it , the word itself and 2 words after it. for eg: “I am going to New York tomorrow” search for “to” print in different column : am going to New York Only 5 words. Help me out.

I tried this but it does not give output:

``def c():     y = "you"     text = "Thank you for chatting with us.  A rep will be with you shortly.          You are currently number 1 in queue. "     for i in text:         for line in i:             split_line = line.split()             if y in split_line:                 index = split_line.index(y)                 print(' '.join(split_line[max(0, index - 2):min(index+3,len(split_line))])) ``