Melvin Udall (Jack Nicholson) is a 60 year old misanthrope who works at home as a best-selling novelist in New York City working on his 62nd book. He suffers from obsessive-compulsive disorder which, paired with his misanthropy, alienates nearly everyone with whom he interacts. He avoids stepping on sidewalk cracks while walking through the city due to a superstition of bad luck, and eats breakfast at the same table in the same restaurant every day using disposable plastic utensils he brings with him due to his pathological fear of germs. He takes an interest in his waitress, Carol Connelly (Helen Hunt), the only server at the restaurant who can tolerate his behavior.
One day, Melvin's apartment neighbor, a gay artist named Simon Bishop (Greg Kinnear), is assaulted and nearly killed during a robbery. Melvin is intimidated by Simon's agent, Frank Sachs (Cuba Gooding, Jr.), into caring for Simon's dog, Verdell, while Simon is hospitalized. Although he initially does not enjoy caring for the dog, Melvin becomes emotionally attached to it. He simultaneously receives more attention from Carol. When Simon is released from the hospital, Melvin is unable to cope emotionally with returning the dog. Melvin's life is further altered when Carol decides to work closer to her home in Brooklyn so she can care for her acutely asthmatic son Spence (Jesse James). Unable to adjust to another waitress, Melvin arranges through his publisher (Linda Gehringer) whose husband is a doctor (Harold Ramis) to pay for her son's considerable medical expenses as long as Carol agrees to return to work. She is overwhelmed at his generosity, and they agree there will be no physical relationship.
Meanwhile, Simon's assault and rehabilitation, coupled with Verdell's preference for Melvin, causes Simon to lose his creative muse. Simon is approaching bankruptcy due to his medical bills. Frank convinces him to go to Baltimore to ask his estranged parents for money. Because Frank is too busy to take the injured Simon to Baltimore himself, Melvin reluctantly agrees to do so; Frank lends Melvin the use of his Saab 900 convertible for the trip. Melvin invites Carol to accompany them on the trip to lessen the awkwardness. She reluctantly accepts the invitation, and relationships among the three develop.
Once in Baltimore, Carol persuades Melvin to take her out to have dinner. Melvin's comments during the dinner greatly flatter and subsequently upset Carol, and she abruptly leaves. Upon seeing the frustrated Carol, Simon begins to sketch her semi-nude in his hotel room and rekindles his creativity, once more feeling a desire to paint. He briefly reconnects with his parents, but is able to tell them that he'll be fine.
After returning to New York, Carol tells Melvin that she does not want him in her life anymore. She later regrets her statement and calls him to apologize. The relationship between Melvin and Carol remains complicated until Simon (who Melvin has allowed to move in with him until he can fully heal from his injuries and get a new apartment) convinces Melvin to declare his love for her. Melvin goes to see Carol, who is hesitant, but agrees to try and establish a relationship with him. The film ends with Melvin and Carol walking together. As he opens a door at an early morning pastry shop for Carol, he realizes that he has stepped on a crack in the pavement.
Output: What disorder does Melvin suffer from?